ds_stoa.utils.logger._logger¶
DS-Stoa Logger.
Classes¶
Context filter to add customized field in the logging |
|
Filter instances are used to perform arbitrary filtering of LogRecords. |
|
Setup logger for ds-stoa package. |
Module Contents¶
- class ds_stoa.utils.logger._logger.ContextFilter(prefix: str | None = None)[source]¶
Bases:
logging.FilterContext filter to add customized field in the logging record. This filter is used to add a prefix to the log.
- class ds_stoa.utils.logger._logger.FolderNameFilter(name='')[source]¶
Bases:
logging.FilterFilter instances are used to perform arbitrary filtering of LogRecords.
Loggers and Handlers can optionally use Filter instances to filter records as desired. The base filter class only allows events which are below a certain point in the logger hierarchy. For example, a filter initialized with “A.B” will allow events logged by loggers “A.B”, “A.B.C”, “A.B.C.D”, “A.B.D” etc. but not “A.BB”, “B.A.B” etc. If initialized with the empty string, all events are passed.
- class ds_stoa.utils.logger._logger.StoaLogger(log_level=logging.DEBUG)[source]¶
Setup logger for ds-stoa package.
Usage: from ds_stoa.utils import LOGGER LOGGER.info(“This is an info message.”) LOGGER.warning(“This is a warning message.”) LOGGER.error(“This is an error message.”) LOGGER.debug(“This is a debug message.”)
- LOGGER¶
- FORMATER¶
- setup_logger(prefix: str, with_file: bool = True) None[source]¶
Instantiates logger with a handler and a log message prefix.
- Parameters:
prefix – Prefix in log message.
with_file – Indicates if logger should also write to file.
- Returns:
None
- info(msg: str) None[source]¶
Log an info level message.
- Parameters:
msg – The message to log.
- Returns:
None
- warning(msg: str) None[source]¶
Log a warning level message.
- Parameters:
msg – The message to log.
- Returns:
None
- error(msg: str) None[source]¶
Log an error level message.
- Parameters:
msg – The message to log.
- Returns:
None
- debug(msg: str) None[source]¶
Log a debug level message.
- Parameters:
msg – The message to log.
- Returns:
None