pip_services3_components.log.Logger module
pip_services3_components.log.Logger
Abstract logger implementation
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_components.log.Logger.
Logger
Bases:
pip_services3_components.log.ILogger.ILogger
,pip_services3_commons.config.IReconfigurable.IReconfigurable
,pip_services3_commons.refer.IReferenceable.IReferenceable
,abc.ABC
Abstract logger that captures and formats log messages. Child classes take the captured messages and write them to their specific destinations.
### Configuration parameters ###
Parameters to pass to the
configure()
method for component configuration:level: maximum log level to capture
source: source (context) name
- ### References ###
*:context-info:*:*:1.0 (optional)
ContextInfo
to detect the context id and specify counters source
-
configure
(config: pip_services3_commons.config.ConfigParams.ConfigParams) Configures component by passing configuration parameters.
- Parameters
config – configuration parameters to be set.
-
debug
(correlation_id: Optional[str], message: str, *args: Any, **kwargs: Any) Logs a high-level debug information for troubleshooting.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
message – a human-readable message to log.
args – arguments to parameterize the message.
kwargs – arguments to parameterize the message.
-
error
(correlation_id: Optional[str], error: Exception, message: str, *args: Any, **kwargs: Any) Logs recoverable application error.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
error – an error object associated with this message.
message – a human-readable message to log.
args – arguments to parameterize the message.
kwargs – arguments to parameterize the message.
-
fatal
(correlation_id: Optional[str], error: Exception, message: str, *args: Any, **kwargs: Any) Logs fatal (unrecoverable) message that caused the process to crash.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
error – an error object associated with this message.
message – a human-readable message to log.
args – arguments to parameterize the message.
kwargs – arguments to parameterize the message.
-
get_level
() → pip_services3_components.log.LogLevel.LogLevel Gets the maximum log level. Messages with higher log level are filtered out.
- Returns
the maximum log level.
-
info
(correlation_id: Optional[str], message: str, *args: Any, **kwargs: Any) Logs an important information message
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
message – a human-readable message to log.
args – arguments to parameterize the message.
kwargs – arguments to parameterize the message.
-
log
(level: pip_services3_components.log.LogLevel.LogLevel, correlation_id: Optional[str], error: Optional[Exception], message: Optional[str], *args: Any, **kwargs: Any) Logs a message at specified log level.
- Parameters
level – a log level.
correlation_id – (optional) transaction id to trace execution through call chain.
error – an error object associated with this message.
message – a human-readable message to log.
args – arguments to parameterize the message.
kwargs – arguments to parameterize the message.
-
set_level
(level: pip_services3_components.log.LogLevel.LogLevel) Set the maximum log level.
- Parameters
level – a new maximum log level.
-
set_references
(references: pip_services3_commons.refer.IReferences.IReferences) Sets references to dependent components.
- Parameters
references – references to locate the component dependencies.
-
set_source
(value: str) Sets the source (context) name.
- Parameters
value – a new source (context) name.
-
trace
(correlation_id: Optional[str], message: str, *args: Any, **kwargs: Any) Logs a low-level debug information for troubleshooting.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
message – a human-readable message to log.
args – arguments to parameterize the message.
kwargs – arguments to parameterize the message.
-
warn
(correlation_id: Optional[str], message: str, *args: Any, **kwargs: Any) Logs a warning that may or may not have a negative impact.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
message – a human-readable message to log.
args – arguments to parameterize the message.
kwargs – arguments to parameterize the message.