New submission from STINNER Victor <victor.stin...@gmail.com>: 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(). ---------- components: Library (Lib) messages: 303945 nosy: haypo priority: normal severity: normal status: open title: Add TRACE level to the logging module versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31732> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com