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.d(message, *args, **kwargs)

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

core.log.debug(message, *args, **kwargs)

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

core.log.e(message, *args, **kwargs)

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

core.log.error(message, *args, **kwargs)

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

core.log.get()[source]

Returns the default Log instance.

core.log.get_lines()

Returns all logged lines.

core.log.i(message, *args, **kwargs)

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

core.log.info(message, *args, **kwargs)

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

core.log.log(log_level, message, *args, **kwargs)

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.

core.log.pop_level()

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

core.log.pop_prefix()

Removes the most recently added prefix from future log messages.

core.log.push_level(level)

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

core.log.push_prefix(prefix)

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

core.log.set_level(level)

Sets the maximum logging level to <level>.

core.log.v(message, *args, **kwargs)

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

core.log.verbose(message, *args, **kwargs)

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

core.log.w(message, *args, **kwargs)

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

core.log.warning(message, *args, **kwargs)

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