logging: Abbreviate logger name for some extremely common logs.

These are the records that we print on each web request.
This commit is contained in:
Greg Price 2017-09-27 14:46:44 -07:00
parent 71b8e7e8d4
commit cc288dacc5
1 changed files with 6 additions and 4 deletions

View File

@ -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 `,`.