pypesto.logging

Logging

Logging convenience functions.

Functions

log([name, level, console, filename])

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

log_level_active(logger, level)

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

log_to_console([level])

Log to console.

log_to_file([level, filename])

Log to file.

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: 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:

method. (See the log) –

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

Log to file.

Parameters:

method. (See the log) –