Message303945
The logging module has already 5 log levels: CRITICAL, ERROR, WARNING, INFO, DEBUG.
https://docs.python.org/dev/library/logging.html#logging-levels
(I don't count NOTSET, I don't consider it to be "usable", at least not in an application or a library.)
For a large application, sometimes we need to a 6th level since DEBUG might be too verbose for some customers (random value: 1 MiB of log per minute). The OpenStack project has 2 additional logging levels: TRACE and AUDIT. See the Oslo Log project used by all OpenStack projects:
https://github.com/openstack/oslo.log/blob/master/oslo_log/handlers.py#L39
The typical usage for TRACE is to log a Python traceback when an exception is logged:
logger.debug("Oops: something bad happened! %s", exc)
for line in my_exception_formatter(exc):
logger.trace(line)
In software development, "trace" term is commonly associated to "debug traces", as in "How to get debug traces?". Or more commonly in Python: "traceback" or "stack trace".
An additional level helps to filter logs, but also to colorize logs differently.
--
I don't propose to add a new AUDIT level since it's not well defined and it's less popular in OpenStack. For example, the Oslo Log module adds a new logger.trace() method, but no logger.audit(). |
|
Date |
User |
Action |
Args |
2017-10-09 12:29:21 | vstinner | set | recipients:
+ vstinner |
2017-10-09 12:29:21 | vstinner | set | messageid: <1507552161.59.0.213398074469.issue31732@psf.upfronthosting.co.za> |
2017-10-09 12:29:21 | vstinner | link | issue31732 messages |
2017-10-09 12:29:21 | vstinner | create | |
|