2.1.1.3. wc_utils.debug_logs package

2.1.1.3.1. Submodules

2.1.1.3.2. 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.

Parameters

config (dict) – dictionary of logger configurations

Returns

handlers dict: loggers

Return type

dict

Raises
  • 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

2.1.1.3.3. wc_utils.debug_logs.core module

Debugging/info log

Author

Jonathan Karr <karr@mssm.edu>

Date

2016-10-25

Copyright

2016-2018, Karr Lab

License

MIT

class wc_utils.debug_logs.core.DebugLogsManager[source]

Bases: object

Manage debug logs

Create and store debug logs.

logs[source]

dictionary of logs stored by a DebugLogsManager instance

Type

dict

__str__()[source]

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.

Parameters
  • name (str) – log name

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

setup_logs(options)[source]

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

2.1.1.3.4. Module contents