Logging

Logging information.

This module defines the behavior for the default SeQUeNCe logging system. The logger used and log format are specified here. Modules will use the logger attribute as a normal logging system, saving log outputs in a user specified file. If a file is not set, no output will be recorded.

src.utils.log.logger

logger object used for logging by sequence modules.

Type:

Logger

src.utils.log.LOG_FORMAT

formatting string for logging as ‘{real time} {simulation time} %{log level} {module name} {message}’.

Type:

str

src.utils.log._log_modules

modules to track with logging (given as list of names)

Type:

List[str]

class src.utils.log.ContextFilter(timeline)

Custom filter class to use for the logger.

filter(record)

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.

src.utils.log.remove_module(module_name: str)

Sets a given module to no longer be tracked.

src.utils.log.set_logger(name: str, timeline, logfile='out.log')

Function to link logger to output file.

The provided timeline is used to add simulation timestamps to the logs.

Parameters:
  • name (str) – name to use for the logger.

  • timeline (Timeline) – timeline to use for simulation timestamps.

  • logfile (str) – file to use in recording log output (default “out.log”)

src.utils.log.set_logger_level(level: str)

Function to set output level of logger without requiring logging import.

Parameters:

level (str) – level to set logger to, given as string (in all caps)

src.utils.log.track_module(module_name: str)

Sets a given module to be tracked by logger.