flowbber.logging

Multiprocess logging management module.

Functions

flowbber.logging.setup_logging(verbosity=0)

Setup logging for this process.

The first time it is called it will create a subprocess to manage the logging and printing, setup the subprocess for stream logging to stdout and setup the main process to queue logging.

In consequence, any subprocess of the main process will inherit the queue logging and become multiprocess logging safe.

This method can be called from subprocesses, but if at least one logging has been performed it will fail as the handler will already exists.

Parameters
verbosity (int) – Verbosity level, as defined by LoggingManager.LEVELS. The greater the number the more information is provided, with 0 as initial level.
flowbber.logging.print(obj, fd='stdout')

Enqueue a print to the given fd.

Parameters
  • obj – Object to print.
  • fd (str) – Name of the file descriptor. Either stdout or stderr only.
flowbber.logging.get_logger(name)

Return a multiprocess safe logger.

Parameters
name (str) – Name of the logger.
Returns
A multiprocess safe logger.
Return type
logging.Logger.