cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
265 stars 62 forks source link

Improve logging #249

Open marimeireles opened 3 years ago

marimeireles commented 3 years ago

Problem

Our logging system is not as good as it could be.

Proposed Solution

I propose doing something like this:

 # assuming loglevel is bound to the string value obtained from the
# command line argument. Convert to upper case to allow the user to
# specify --log=DEBUG or --log=debug
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int):
    raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level, ...)

Which allows us to pass the desired logging level as cmd line option.

See more context on how to implement it here: https://docs.python.org/3/howto/logging.html