magmap.settings.logs module#
Logging utilities.
- class magmap.settings.logs.LogWriter(fn_logging)[source]#
Bases:
objectFile-like object to write standard output to logging functions.
- magmap.settings.logs.add_file_handler(logger, path, backups=5)[source]#
Add a rotating log file handler with a new log file.
Rotates the file each time this function is called for the given number of backups rather than by size or time. Avoids file conflicts from multiple instances when permission errors occur (eg on Windows), instead creating a log filed named with an incremented number (eg
out1.log).
- magmap.settings.logs.setup_logger()[source]#
Set up a basic root logger with a stream handler.
- Returns:
Root logger for the application.
- Return type:
- magmap.settings.logs.update_log_level(logger, level)[source]#
Update the logging level.
- Parameters:
logger (
logging.Logger) – Logger to update.level (Union[str, int]) – Level given either as a string corresponding to
Loggerlevels, or their corresponding integers, ranging from 0 (NOTSET) to 50 (CRITICAL). For convenience, values can be given from 0-5, which will be multiplied by 10.
- Returns:
The logger for chained calls.
- Return type: