osl_ephys.utils.logger#
Logging module for OSL
Heavily inspired by logging in OSL.
Attributes#
Functions#
|
Initialise the osl-ephys module osl_logger. |
|
Set new logging level for osl-ephys module. |
|
Return current logging level for osl-ephys module. |
|
Execute logger.info if an OSL logger has been setup, otherwise print. |
Module Contents#
- osl_ephys.utils.logger.default_config = Multiline-String[source]#
Show Value
""" version: 1 loggers: osl_ephys: level: DEBUG handlers: [console, file] propagate: false handlers: console: class : logging.StreamHandler formatter: brief level : DEBUG stream : ext://sys.stdout file: class : logging.handlers.RotatingFileHandler formatter: verbose filename: {log_file} backupCount: 3 maxBytes: 102400 formatters: brief: format: '{prefix} %(message)s' default: format: '[%(asctime)s] {prefix} %(levelname)-8s : %(message)s' datefmt: '%H:%M:%S' verbose: format: '[%(asctime)s] {prefix} - %(levelname)s - osl-ephys.%(module)s:%(lineno)s : %(message)s' datefmt: '%Y-%m-%d %H:%M:%S' disable_existing_loggers: true """
- osl_ephys.utils.logger.set_up(prefix='', log_file=None, level=None, console_format=None, startup=True)[source]#
Initialise the osl-ephys module osl_logger.
- Parameters:
prefix (str) – Optional prefix to attach to osl_logger output
log_file (str) – Optional path to a log file to record osl_logger output
level ({'CRITICAL', 'WARNING', 'INFO', 'DEBUG'}) – String indicating initial logging level
console_format (str) – Formatting string for console logging.
- osl_ephys.utils.logger.set_level(level, handler='console')[source]#
Set new logging level for osl-ephys module.
- Parameters:
level ({'CRITICAL', 'WARNING', 'INFO', 'DEBUG'}) – String indicating new logging level
handler (str) – The handler to set the level for. Defaults to ‘console’.
- osl_ephys.utils.logger.get_level(handler='console')[source]#
Return current logging level for osl-ephys module.
- Parameters:
handler (str) – The handler to get the level for. Defaults to ‘console’.
- Returns:
level – String indicating current logging level
- Return type:
{‘CRITICAL’, ‘WARNING’, ‘INFO’, ‘DEBUG’}