All Projects β†’ Edinburgh-Genome-Foundry β†’ Proglog

Edinburgh-Genome-Foundry / Proglog

Licence: MIT license
πŸ“ Logs and progress bars manager for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Proglog

RxActivityIndicator-Android
A small library that helps you keep track of operations progress. It allows you to show progress bar (indicator) in a convenient way.
Stars: ✭ 12 (-86.21%)
Mutual labels:  progress-bar
Meteor-logger-file
πŸ”– Meteor Logging: Store application log messages into file (FS)
Stars: ✭ 24 (-72.41%)
Mutual labels:  logger
random-logger
Docker image for a random log generator.
Stars: ✭ 104 (+19.54%)
Mutual labels:  logger
CustomProgress
δΈ€ζ¬ΎεΈΈθ§ηš„θΏ›εΊ¦ζ‘εŠ θ½½ζ‘†ζžΆ
Stars: ✭ 32 (-63.22%)
Mutual labels:  progress-bar
AndroidTableauLibrary
AndroidTableauLibrary is an Android SDK library supports variety of analytic graphs which developers simply integrate on Android project. - by @sung2063
Stars: ✭ 53 (-39.08%)
Mutual labels:  progress-bar
circlebars
Add circular progress bars and countdown timers easily with circlebars Created by @itaditya. Demo at >
Stars: ✭ 38 (-56.32%)
Mutual labels:  progress-bar
lgr
Basic logger with some extras
Stars: ✭ 33 (-62.07%)
Mutual labels:  logger
GoogleCloudLogging
Swift (Darwin) library for logging application events in Google Cloud.
Stars: ✭ 24 (-72.41%)
Mutual labels:  logger
ShipBookSDK-Android
A logging system for Android
Stars: ✭ 19 (-78.16%)
Mutual labels:  logger
l
Cross-platform html/io [L]ogger with simple API.
Stars: ✭ 26 (-70.11%)
Mutual labels:  logger
noodlog
🍜 Parametrized JSON logging library in Golang which lets you obfuscate sensitive data and marshal any kind of content.
Stars: ✭ 42 (-51.72%)
Mutual labels:  logger
turbo-log
Fast log message inserting for quick debug.
Stars: ✭ 66 (-24.14%)
Mutual labels:  logger
logger
Gin middleware/handler to logger url path using rs/zerolog
Stars: ✭ 119 (+36.78%)
Mutual labels:  logger
log
A simple to use log system, minimalist but with features for debugging and differentiation of messages
Stars: ✭ 21 (-75.86%)
Mutual labels:  logger
sqlite micro logger arduino
Fast and Lean Sqlite database logger for Microcontrollers
Stars: ✭ 128 (+47.13%)
Mutual labels:  logger
Laravel-FluentLogger
fluent logger for laravel (with Monolog handler for Fluentd)
Stars: ✭ 55 (-36.78%)
Mutual labels:  logger
neptune-client
πŸ“’ Experiment tracking tool and model registry
Stars: ✭ 348 (+300%)
Mutual labels:  logger
pio
Low-level package that provides an easy way to centralize different output targets. Supports colors and text decoration to all popular terminals
Stars: ✭ 21 (-75.86%)
Mutual labels:  logger
apollo-log
A logging extension for the Apollo GraphQL Server
Stars: ✭ 64 (-26.44%)
Mutual labels:  logger
faraday-detailed logger
A detailed request and response logger for Faraday.
Stars: ✭ 56 (-35.63%)
Mutual labels:  logger

Proglog Logo

GitHub CI build status https://coveralls.io/repos/github/Edinburgh-Genome-Foundry/Proglog/badge.svg?branch=master

Proglog is a progress logging system for Python. It allows to build complex libraries while giving your users control over logs, callbacks and progress bars.

What problems does it solve ?

Libraries like tqdm or progress are great for quickly adding progress bars to your scripts, but become difficult to manage when building larger projects.

For instance, you will need to write different code depending on whether you are displaying the progress in a console, a Jupyter notebook, or a webpage.

Sometimes a single program may have to handle many logs and progress bars coming from different subprograms and libraries, at which case you may want to let the final user decide which progress bars they want to display or to mute, even when these progress bars are handled deep down in your program.

For instance if your program 1 calls a program 2 and program 3 (possibly from other libraries), you may want to be able to silence the progress bars of routine 2, or to only show the progress bars of routine 1. As long as all routines use Proglog, this will be easy to do.

You may also want to log more than just progress bars, have specific callback fonctions, print the logs in human-readable format... Proglog provides all these features.

Usage

Assume that you are writing a library called my_library in which you define a routine as follows:

import time  # for simulating computing time
from proglog import default_bar_logger

def my_routine(iterations=10, logger='bar'):
    """Run several loops to showcase Proglog."""
    logger = default_bar_logger(logger)  # shorthand to generate a bar logger
    for i in logger.iter_bar(iteration=range(iterations)):
        for j in logger.iter_bar(animal=['dog', 'cat', 'rat', 'duck']):
            time.sleep(0.1)  # simulate some computing time

Now when the library users run a program in the console, they will get a console progress bar:

from my_library import my_routine
my_routine()

If the users run the routine inside a Jupyter/IPython notebook, they only need to write proglog.notebook() at the beginning of the notebook to obtain HTML progress bars:

import proglog
proglog.notebook()

from my_library import my_routine
my_routine()

If the user wishes to turn off all progress bars:

from my_library import my_routine
my_routine(logger=None)

If the user is running the routine on a web server and would want to attach the data to an asynchronous Python-RQ job, all they need is yet a different logger:

from proglog import RqWorkerBarLogger
from my_library import my_routine

logger = RqWorkerBarLogger(job=some_python_rq_job)
my_routine(logger=logger)

This allows to then display progress bars on the website such as these (see the EGF CUBA project for an example of website using Proglog):

The user may also want a custom progress logger which selectively ignores the animals progress bar, and only updates its bars every second (to save computing time):

from proglog import TqdmProgressBarLogger
from my_library import my_routine

logger = TqdmProgressBarLogger(ignored_bars=('animal',),
                               min_time_interval=1.0)
my_routine(logger=logger)

Proglog loggers can be used for much more than just progress bars. They can in fact store any kind of data with a simple API:

logger(message='Now running the main program, be patient...')
logger(current_animal='cat')
logger(last_number_tried=1235)

For more complex customization, such as adding callback functions which will be executed every time the logger's state is updated, simply create a new logger class:

from proglog import ProgressBarLogger
from my_library import my_routine

class MyBarLogger(ProgressBarLogger):

    def callback(self, **changes):
        # Every time the logger is updated, this function is called with
        # the `changes` dictionnary of the form `parameter: new value`.

        for (parameter, new_value) in changes.items():
            print ('Parameter %s is now %s' % (parameter, value))

logger = MyBarLogger()
my_routine(logger=logger)

When writing libraries which all log progress and may depend on each other, simply pass the Proglog logger from one program to its dependencies, to obtain one logger keeping track of all progress across libraries at once:

Note that this implies that not two libraries use the same variables or loop names, which can be avoided by attributing prefixes to these names:

for i in logger.iter_bar(iteration=range(iterations), bar_prefix='libraryname_'):
    ...

Installation

You can install Proglog through PIP:

pip install proglog

Alternatively, you can unzip the sources in a folder and type:

python setup.py install

To use the tqdm notebook-style progress bars you need to install iwidgets:

pip install ipywidgets

This should automatically enable it; for older versions try:

jupyter nbextension enable --py --sys-prefix widgetsnbextension

License = MIT

Proglog is an open-source software originally written at the Edinburgh Genome Foundry by Zulko and released on Github under the MIT license (Copyright 2017 Edinburgh Genome Foundry).

Proglog was not written by loggology experts, it just works with our projects and we use it a lot. Everyone is welcome to contribute if you find bugs or limitations !

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].