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='pypesto', level=20, console=True, filename='')[source]

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

Parameters:
  • name (str) – The name of the logger.

  • level (int) – The output level to use.

  • console (bool) – If True, messages are logged to console.

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

pypesto.logging.log_level_active(logger, level)[source]

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

This is useful in case log expressions are costly.

Parameters:
  • logger (Logger) – The logger.

  • level (int) – The requested log level.

Return type:

bool

Returns:

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

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

Log to console.

Parameters:
  • method. (See the log)

  • level (int)

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

Log to file.

Parameters:
  • method. (See the log)

  • level (int)

  • filename (str)