pyani.logger module

Module providing support for package-level logging.

class pyani.logger.NoColorFormatter(fmt=None, datefmt=None, style='%')[source]

Bases: logging.Formatter

Log formatter that strips terminal colour escape codes from the log message.

ANSI_RE = re.compile('\\x1b\\[[0-9;]*m')
format(record)[source]

Return logger message with terminal escapes removed.

pyani.logger.config_logger(args: Optional[argparse.Namespace] = None) → None[source]

Configure package-level logging.

Parameters:args – CLI namespace; logfile is used to create a logfile, verbose and debug control logging level.

We configure a logger at package level, from which the module will inherit. If CLI args are provided, these are used to define output streams, and logging level.