mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
logging: Make our own Formatter class.
This doesn't yet do much, but it gives us a suitable place to add code to customize how log messages are displayed, beyond what a format string passed to the default formatter can do.
This commit is contained in:
@@ -125,6 +125,17 @@ def skip_site_packages_logs(record):
|
||||
return False
|
||||
return True
|
||||
|
||||
class ZulipFormatter(logging.Formatter):
|
||||
_fmt = '%(asctime)s %(levelname)-8s %(message)s'
|
||||
|
||||
def __init__(self):
|
||||
# type: () -> None
|
||||
super().__init__(fmt=self._fmt)
|
||||
|
||||
def format(self, record):
|
||||
# type: (logging.LogRecord) -> str
|
||||
return super().format(record)
|
||||
|
||||
def create_logger(name, log_file, log_level, log_format="%(asctime)s %(levelname)-8s %(message)s"):
|
||||
# type: (str, str, str, str) -> Logger
|
||||
"""Creates a named logger for use in logging content to a certain
|
||||
|
||||
Reference in New Issue
Block a user