pygreynoise
pygreynoise copied to clipboard
do not setup logging in library code
https://github.com/GreyNoise-Intelligence/pygreynoise/blob/c1fc4f4eae47e2eec1a2e3b0b487f7d88b4fdf79/src/greynoise/api/init.py#L17
This is a big no no. logging should be setup by the user of the module not the module itself. Use:
logger = logging.getLogger(___name__)
https://docs.python.org/3.7/howto/logging.html#library-config
read the NOTE section.
Note It is strongly advised that you do not add any handlers other than NullHandler to your library’s loggers. This is because the configuration of handlers is the prerogative of the application developer who uses your library. The application developer knows their target audience and what handlers are most appropriate for their application: if you add handlers ‘under the hood’, you might well interfere with their ability to carry out unit tests and deliver logs which suit their requirements.
Thanks for the note @guzzijones : I will review it and see what we can do.
@guzzijones : I've got some WIP changes in branch v1.3.0_updates. Feel free to comment if you think this covers what you requested with this fix.