-
Notifications
You must be signed in to change notification settings - Fork 278
Add logging config and guidelines #1132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have spent quite some effort on trying to use the |
Some good advice on when to log in #1145 |
The important rules that I think work are:
|
After wrestling with the current log module a few times I'll document my understanding of it's contents:
In my opinion the log module is not needed:
|
I think we should use a log module as a central place to configure a base logger, from which all other module loggers inherit automatically by name: # In log.py (configure base logger handler, format, default level, etc. eg. based on 'tuf.settings')
import logging
logger = logging.getLogger("tuf")
logger.addHandler(...
... # In __init__.py (initialize base handler before anything else)
# This is the only place where 'tuf.log' needs to be imported
import tuf.log
# Alternatively, we could just configure the base logger here and
# omit the 'log.py' module. # In any other tuf.<module>.py we inherit just by name
import logging
logger = logging.getLogger(__name__) # __name__ == 'tuf.<module>' and thus inherits from 'tuf' base logger.
... This also allows application developers to just grab the base handler via |
|
Yes, if we don't need any other customization then it's enough to just add it to Regarding
AFAIK that isn't even necessary. |
Another logging-related discussion: #1334 |
This issue was created for python-tuf's custom The latest python-tuf release uses the Python builtin Logging related issues (e.g. #1875, #1804, #1120) should be resolved according to these official recommendations |
Add project-wide configuration for the Python logging module, create guideline on how to use it (when to use which logging level), and use it instead of our own logging wrapper.
The text was updated successfully, but these errors were encountered: