Logging

Logging convenience functions.

pypesto.logging.log(name: str = 'pypesto', level: int = 20, console: bool = True, filename: str = '')[source]

Log messages from name with level to any combination of console/file.

Parameters
  • name – The name of the logger.

  • level – The output level to use.

  • console – If True, messages are logged to console.

  • filename – If specified, messages are logged to a file with this name.

pypesto.logging.log_level_active(logger: logging.Logger, level: int)bool[source]

Check whether the requested log level is active in any handler.

This is useful in case log expressions are costly.

Parameters
  • logger – The logger.

  • level – The requested log level.

Returns

Whether there is a handler registered that handles events of importance at least level and higher.

Return type

active

pypesto.logging.log_to_console(level: int = 20)[source]

Log to console.

Parameters

the log method. (See) –

pypesto.logging.log_to_file(level: int = 20, filename: str = '.pypesto_logging.log')[source]

Log to file.

Parameters

the log method. (See) –