core.log module

Logging module.

class core.log.Log[source]

Bases: object

Logging class.

d(message, *args, **kwargs)[source]

Writes a DEBUG message to the log. See Log.log for details.

e(message, *args, **kwargs)[source]

Writes an ERROR message to the log. See Log.log for details.

get_lines()[source]

Returns all logged lines.

i(message, *args, **kwargs)[source]

Writes a INFO message to the log. See Log.log for details.

log(log_level, message, *args, **kwargs)[source]

Logs a message if the current logging level includes messages at level <log_level>.

Parameters
  • log_level – the level to log the message at. If less than the current logging level, nothing will happen.

  • message – the message to log.

  • *args – Used to format the message with the % operator.

  • stack – if True, logs a stack trace. If sys.excinfo contains an exception, this will be formatted and logged instead.

pop_level()[source]

Restores the previous logging level, if the level stack is not empty.

pop_prefix()[source]

Removes the most recently added prefix from future log messages.

push_level(level)[source]

Temporarily changes the logging level to <level>. Call pop_level to restore the previous level.

push_prefix(prefix)[source]

Adds a prefix to future log messages. Old prefixes will appear before new prefixes.

set_level(level)[source]

Sets the maximum logging level to <level>.

v(message, *args, **kwargs)[source]

Writes a VERBOSE message to the log. See Log.log for details.

w(message, *args, **kwargs)[source]

Writes a WARNING message to the log. See Log.log for details.

core.log.get()[source]

Returns the default Log instance.