class documentation
class LogHandler: (source)
Constructor: LogHandler(log_path, program, lean_format, include_external, supress_console)
This class handles enhanced console and rotating file in loguru logging.
- The following functionality is implemented:
- thread and multiprocessing safe.
- Rotating log files are based on date.
- Console output is colored based on log level.
| Method | __init__ |
Add console and rotating log file handler into Loguru logging. |
| Method | start |
Set initial log level filter. |
| Method | update |
Update logging level filter. |
| Instance Variable | log |
DynamicLogFilter object. |
def __init__(self, log_path:
Path, program: str, lean_format: bool = True, include_external: bool = False, supress_console: bool = False):
(source)
¶
Add console and rotating log file handler into Loguru logging.
Setting supress_console=True is used when building a Windows service or when a Linux program is managed by systemctl.
| Parameters | |
logPath | Logfile path. |
program:str | Name of logging program. |
leanbool | Use a lean log format; when you set it to False, the standard loguru format is used (default is True). |
includebool | Include python standard logging into Loguru (default is False). |
supressbool | Suppress console logging (default is False). |
Update logging level filter.
- Possible log_level values are:
- trace,
- debug,
- info,
- success,
- warning,
- error,
- critical.
| Parameters | |
logstr | Name of applied log level. |