From cc288dacc522efef75d12ac18853a29806838f85 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 27 Sep 2017 14:46:44 -0700 Subject: [PATCH] logging: Abbreviate logger name for some extremely common logs. These are the records that we print on each web request. --- zerver/lib/logging_util.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zerver/lib/logging_util.py b/zerver/lib/logging_util.py index 148cee080e..69125e09d2 100644 --- a/zerver/lib/logging_util.py +++ b/zerver/lib/logging_util.py @@ -125,12 +125,14 @@ def skip_site_packages_logs(record): return False return True +logger_nicknames = { + 'root': '', # This one is more like undoing a nickname. + 'zulip.requests': 'zr', # Super common. +} + def find_log_origin(record): # type: (logging.LogRecord) -> str - if record.name == 'root': - return '' - else: - return record.name + return logger_nicknames.get(record.name, record.name) class ZulipFormatter(logging.Formatter): # Used in the base implementation. Default uses `,`.