logger
module core.utils.logger
class Logger
A reimplementation of the logging module.
Why? The logging
module from the Python standard library is kind of hard to configure with some setups we have on the server-side. That is why we have decided to use a custom logging class in some of our bigger projects instead.
This class is simply formatting log lines, appending them to the log files and providing a simple API.
method __init__
__init__(origin: str = 'pyra.core', just_print: bool = False) → None
Create a new logger instance.
With just_print = True
, the log lines will be formatted like in the log files but only printed to the console.
method archive
archive() → None
Only keep the lines from the last 5 minutes in "logs/debug.log".
method debug
debug(message: str) → None
Write a debug log (to debug only). Used for verbose output
method error
error(message: str) → None
Write an error log (to debug and info)
method exception
exception(e: Exception) → None
Log the traceback of an exception
method info
info(message: str) → None
Write an info log (to debug and info)
method warning
warning(message: str) → None
Write a warning log (to debug and info)