wc_utils.debug_logs package Submodules wc_utils.debug_logs.config module

exception wc_utils.debug_logs.config.ConfigurationError[source]

Bases: Exception

An error in a logging configuration

class wc_utils.debug_logs.config.LoggerConfigurator[source]

Bases: object

A class with static methods that configures log files.

static from_dict(config)[source]

Create and configure logs from a dictionary which describes their configuration

Caution: because logging2.Logger() caches handlers and loggers, from_dict() may not create a logger with the configuration requested. In particular, creating a logger that has the same name as an existing logger will return the existing log without considering any of the parameters provided by config. In addition, adding a handler to a logger (using logger.add_handler())) will silently fail if the name of the handler being added is the same as the name of an existing handler used by the logger.


config (dict) – dictionary of logger configurations


handlers dict: loggers

Return type:


  • log.ConfigurationError – For unsupported handler types
  • ModuleNotFoundError – If logging2 is not installed
static from_yaml(config_path)[source]

Create and configure logs from a YAML file which describes their configuration

Deprecated in favor of ConfigObj

Returns:handlers dict: loggers
Return type:dict
Parameters:config_path (str) – path to configuration file written in YAML wc_utils.debug_logs.core module

Debugging/info log

Author:Jonathan Karr <karr@mssm.edu>
Copyright:2016-2018, Karr Lab
class wc_utils.debug_logs.core.DebugLogsManager[source]

Bases: object

Manage debug logs

Create and store debug logs.


dictionary of logs stored by a DebugLogsManager instance


Return string representation of this DebugLogsManager’s logs

Returns:the name, level, template and filename (if used) for each log
Return type:str
get_log(name, logs=None)[source]

Returns log with name name. Optionally, search for log in dict logs.

  • name (str) – log name
  • logs (dict, optional) – dictionary of logs to search

Configure and create a log from a log description in a nested dict.

Typically the log description is obtained by reading a .cfg file with ConfigObj.

Parameters:options (dict) – a configuration
Returns:this DebugLogsManager
Return type:DebugLogsManager Module contents