slowdown.logging
– Cooperative and simple logging¶
This module providers a logging implementation for high concurrent services. Instead of performing file operations immediately, this module performs writes in the background when the buffer is full.
Example:
>>> file = RotatingFile(application.fs, '$LOGS/error-%Y%m.log')
>>> logger = Logger(file, level=DEBUG)
>>> logger.debug('debug msg')
>>> logger.info('info msg')
>>> logger.level = ERROR
>>> logger.error('error msg')
>>> logger.critical('fatal msg')
-
class
slowdown.logging.
File
(fs: slowdown.fs.FS, filename: str, encoding: str = 'utf-8')¶
-
class
slowdown.logging.
Logger
(file: File = None, level: int = NOTSET, immediately: bool = True, accesslog_fmt: str = None, errorlog_fmt: str = None, strftime_fmt: str = None)¶ -
access
(msg: str) → None¶ Log a message on the access log.
-
critical
(msg: str) → None¶ Log a message with severity ‘CRITICAL’ on the error log.
-
fatal
(msg: str) → None¶ Log a message with severity ‘FATAL’ on the error log.
-
error
(msg: str) → None¶ Log a message with severity ‘ERROR’ on the error log.
-
warning
(msg: str) → None¶ Log a message with severity ‘WARNING’ on the error log.
-
warn
(msg: str) → None¶ Log a message with severity ‘WARNING’ on the error log.
-
info
(msg: str) → None¶ Log a message with severity ‘INFO’ on the error log.
-
debug
(msg: str) → None¶ Log a message with severity ‘DEBUG’ on the error log.
-
-
class
slowdown.logging.
RotatingFile
(fs: slowdown.fs.FS, fmt: str, maxsize: int = - 1, encoding: str = 'utf-8')¶ The name of the log file is obtained via time.strftime(fmt)