pygcam.log

This module allows modules to register themselves for logging which is turned on after the app reads configuration information. Modules call

logger = pygcam.log.getLogger(__name__)

as a top-level statement, evaluated at load time. This returns the logger, which may not yet be configured. When the configuration file has been read, all registered loggers are initialized, and all subsequently registered loggers are initialized upon instantiation.

API

pygcam.log.configureLogs(force=False)

Do basicConfig setup and configure all known loggers based on the information in the config instance given. If already configured, just return, unless force == True.

Parameters:force – (bool) if True, reconfigure the logs even if already configured.
Returns:none
pygcam.log.getLogLevel()

Get the currently set LogLevel.

Returns:(str) one of 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL'
pygcam.log.getLogger(name)

Register a logger, which will be set up after the configuration file is read.

Parameters:name – the name of the logger, conventionally passed as __name__.
Returns:a logging logger instance
pygcam.log.resetLogLevel()

Set the log level to the current value of GCAM.LogLevel, which may be different once the default project name has been set.

Returns:none
pygcam.log.setLogLevel(level)

Set the logging level for all defined loggers.

Parameters:level – (str) one of 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL' (case insensitive)
Returns:none