log: Define TRACE log level with name and color
This commit is contained in:
parent
df67d708db
commit
79dbc652e0
@ -32,6 +32,11 @@ v0.20.0 (UNRELEASED)
|
||||
This can be used to show absolutely all log records, including those at
|
||||
custom levels below ``DEBUG``.
|
||||
|
||||
**Logging**
|
||||
|
||||
- Add custom log level ``TRACE`` (numerical level 5), which can be used by
|
||||
Mopidy and extensions to log at an even more detailed level than ``DEBUG``.
|
||||
|
||||
**Local backend**
|
||||
|
||||
- Add cover URL to all scanned files with MusicBrainz album IDs. (Fixes:
|
||||
|
||||
@ -14,6 +14,9 @@ LOG_LEVELS = {
|
||||
3: dict(root=logging.DEBUG, mopidy=logging.DEBUG),
|
||||
}
|
||||
|
||||
# Custom log level which has even lower priority than DEBUG
|
||||
TRACE_LOG_LEVEL = 5
|
||||
|
||||
|
||||
class DelayedHandler(logging.Handler):
|
||||
def __init__(self):
|
||||
@ -42,6 +45,8 @@ def bootstrap_delayed_logging():
|
||||
|
||||
|
||||
def setup_logging(config, verbosity_level, save_debug_log):
|
||||
logging.addLevelName(TRACE_LOG_LEVEL, 'TRACE')
|
||||
|
||||
logging.captureWarnings(True)
|
||||
|
||||
if config['logging']['config_file']:
|
||||
@ -137,6 +142,7 @@ class ColorizingStreamHandler(logging.StreamHandler):
|
||||
|
||||
# Map logging levels to (background, foreground, bold/intense)
|
||||
level_map = {
|
||||
TRACE_LOG_LEVEL: (None, 'blue', False),
|
||||
logging.DEBUG: (None, 'blue', False),
|
||||
logging.INFO: (None, 'white', False),
|
||||
logging.WARNING: (None, 'yellow', False),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user