mlair.helpers.logger

Logger class.

Module Contents

Classes

Logger

Basic logger class to unify all logging outputs.

class mlair.helpers.logger.Logger(log_path=None, level_file=logging.DEBUG, level_stream=logging.INFO)

Basic logger class to unify all logging outputs.

Logs are saved in local file and returned to std output. In default settings, logging level of file logger is DEBUG, logging level of stream logger is INFO. Class must be imported and initialised in starting script, all subscripts should log with logging.info(), debug, …

static setup_logging_path(path: str = None)

Check if given path exists and creates if not.

If path is None, use path from main. The logging file is named like logging_<runtime>.log where runtime=`%Y-%m-%d_%H-%M-%S` of current run.

Parameters

path – path to logfile

Returns

path of logfile

logger_console(self, level: int)

Define a stream handler which writes messages of given level or higher to std out.

Parameters

level – logging level as integer, e.g. logging.DEBUG or 10

Returns

defines stream handler