Repository navigation
Conversation
2 similar comments
|
What if When the call is placed at the module level it will create a new logger during import. If the dev using the library then loads a logger config from a file |
|
I think that would be possible. BTW, my pull request is based on the logging pattern found in other popular libraries, e.g. https://github.com/shazow/urllib3/blob/master/urllib3/response.py |
|
I think that initializing loggers in every single function or class of a module can really clutter up the code. The red warning box in the python 3.6 documentation makes it pretty clear that the default of However since gpxpy does not have that much logging, class/function level loggers wouldn't clutter the code too much here. So in this case one could go either way. edit: Warning box at https://docs.python.org/3.6/howto/logging.html , about 2/3 down the page |
|
Merged in |
Use a named loggers in all modules of gpxpy (
log = mod_logging.getLogger(__name__)) -- as recommended by https://docs.python.org/3/library/logging.htmlThis enables applications to configure gpxpy's logger separately (e.g.
logging.getLogger('gpxpy').setLevel(logging.CRITICAL)...).