mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +00:00
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:
@@ -125,12 +125,14 @@ def skip_site_packages_logs(record):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
logger_nicknames = {
|
||||||
|
'root': '', # This one is more like undoing a nickname.
|
||||||
|
'zulip.requests': 'zr', # Super common.
|
||||||
|
}
|
||||||
|
|
||||||
def find_log_origin(record):
|
def find_log_origin(record):
|
||||||
# type: (logging.LogRecord) -> str
|
# type: (logging.LogRecord) -> str
|
||||||
if record.name == 'root':
|
return logger_nicknames.get(record.name, record.name)
|
||||||
return ''
|
|
||||||
else:
|
|
||||||
return record.name
|
|
||||||
|
|
||||||
class ZulipFormatter(logging.Formatter):
|
class ZulipFormatter(logging.Formatter):
|
||||||
# Used in the base implementation. Default uses `,`.
|
# Used in the base implementation. Default uses `,`.
|
||||||
|
|||||||
Reference in New Issue
Block a user