morpheus.utils.logger
Logging utilities for Morpheus
Functions
configure_logging (*extra_handlers[, ...]) |
Configures Morpheus logging in one of two ways. |
deprecated_message_warning (cls, new_cls) |
Log a warning about a deprecated message. |
deprecated_stage_warning (logger, cls, name) |
Log a warning about a deprecated stage. |
reset_logging ([logger_name]) |
Resets the Morpheus logging system. |
set_log_level (log_level) |
Set the Morpheus logging level. |
Classes
LogLevels (value) |
An enumeration. |
TqdmLoggingHandler ([level]) |
Console log handler used by Morpheus, provides colorized output and sends all logs at level ERROR and above to stderr, others to stdout. |
- configure_logging(*extra_handlers, log_level=None, log_config_file=None)[source]
Configures Morpheus logging in one of two ways. Either specifying a logging config file to load or a logging level which will use a default configuration. The default configuration outputs to both the console and a file. Sets up a logging producer/consumer that works well in multi-thread/process environments.
- Parameters
- *extra_handlers: List of handlers to add to existing default console and file handlers.
- log_level: int
- log_config_file: str, optional (default = None):
Specifies the log level and above to output. Must be one of the available levels in the
logging
module.Instructs Morpheus to configure logging via a config file. These config files can be complex and are outlined in the Python logging documentation. Will accept either a
.ini
file which will be loaded vialogging.config.fileConfig()
(See here) or a.json
file which will be loaded vialogging.config.dictConfig()
(See here). Defaults to None.
- deprecated_message_warning(cls, new_cls)[source]
Log a warning about a deprecated message.
- deprecated_stage_warning(logger, cls, name, reason=None)[source]
Log a warning about a deprecated stage.
- reset_logging(logger_name='morpheus')[source]
Resets the Morpheus logging system. This will remove all handlers from the Morpheus logger and stop the queue listener. This is useful for testing where the logging system needs to be reconfigured multiple times or reconfigured with different settings.
- set_log_level(log_level)[source]
Set the Morpheus logging level. Also propagates the value to MRC’s logging system to keep the logging levels in sync
- Parameters
- log_level
One of the levels from the
logging
module. i.e.logging.DEBUG
,logging.INFO
,logging.WARN
,logging.ERROR
, etc.- Returns
- int
The previously set logging level