Logger

Reserved Log Levels

These reserved log levels help filter and control which log messages get output to the console/main log and which go to only the Action.logfile. By using the Debug settings when running a workflow, you can lower the required log level to appear in the main log.

sane.logger.STDOUT = 18

The log level any stdout captured in Action or Environment is output at

sane.logger.ACT_INFO = 19

The default log level of Action.log(), i.e. the log level most Action activity is output at

sane.logger.MAIN_LOG = 20

The default log level needed to output to the main logfile/console

class sane.logger.Logger[source]

User Interface

User Methods

log(*args, level=None, **kwargs)[source]

Wrapper function around logging.Logger.log()

The args and kwargs parameters gets passed to print() redirected into a string. The string is prefixed with [<current_logname>] and is then logged out using the current internal logging.Logger and any format that logger applies.

Parameters:

level (int) – the logging level the message should be output as, default is default_log_level

log_push(levels=1)[source]

Add a level of indentation to subsequent messages

log_pop(levels=1)[source]

Remove a level of indentation to subsequent messages

push_logscope(scope)[source]

Push a scope context string onto the stack

Adding scope context causes subsequent log messages to be suffixed with the current scope as <logname>::<current scope>

pop_logscope()[source]

Pop a scope context string from the stack

Removing scope context causes subsequent messages to resume with the previous scope if present, or return to the original logname only.

Internal API

The following documentation is provided for advanced use in the creation of custom classes.

default_log_level

The default log level to use when no explicit level is provided to log()

label_length

Pad length to use for generating message prefix (logname and scope)

property logname

The current base logname of this object

property current_logname

Give the current logname as would appear in messages, including scope context

logger
log_flush()[source]

Force flush all handlers associated with the internal logging.Logger

__init__(logname, **kwargs)[source]
classmethod __new__(*args, **kwargs)