HedLogger

class HedLogger(name=None)[source]

Log status messages organized by key.

Methods

HedLogger.__init__([name])

Constructor for the HED logger.

HedLogger.add(key, msg[, level, also_print])

Add an entry to this log.

HedLogger.get_log(key)

Get all the log entries stored under the key.

HedLogger.get_log_keys()

Return a list of keys for this log.

HedLogger.get_log_string([level])

Return the log as a string, with entries separated by newlines.

Attributes

HedLogger.__init__(name=None)[source]

Constructor for the HED logger.

Parameters:

name (str) – Identifying name of the logger.

HedLogger.add(key, msg, level='', also_print=False)[source]

Add an entry to this log.

Parameters:
  • key (str) – Key used to organize log messages.

  • msg (str) – Message to log.

  • level (str) – Level of importance for filtering messages.

  • also_print (bool) – If False (the default) nothing is output, otherwise the log entry output to stdout.

HedLogger.get_log(key)[source]

Get all the log entries stored under the key.

Parameters:

key (str) – The key whose log messages are retrieved.

Returns:

List of log entries associated with this key.

Return type:

list

HedLogger.get_log_keys()[source]

Return a list of keys for this log.

Returns:

list of organizational keys for this log.

Return type:

list

HedLogger.get_log_string(level=None)[source]

Return the log as a string, with entries separated by newlines.

Parameters:

level (str or None) – Include only the entries from this level. If None, do all.

Returns:

The log as a string separated by newlines.

Return type:

str