ctl.plugins.log
Plugin that allows you to manipulate logging functionality
Classes
LogPlugin
LogPlugin(ctl.plugins.PluginBase)
manipulate message logging
Instanced Attributes
- loggers(
list
): list of loggers this plugin is attached to
Class Attributes
- ConfigSchema (
ConfigSchema Class
): Base plugin config schema
Methods
apply
def apply(self, message, level)
Apply changes to an incoming message
Arguments
- message (
str
) - level (
str
): logging severity level
Returns
modified message (str
)
attach_to_logger
def attach_to_logger(self, logger_name)
Attach plugin to python logger
Arguments
- logger_name (
str
)
configure_logger
def configure_logger(self, logger_name, logger_config)
Configure python logger from plugin config
If your logger config attribute specifies things like formatting and handlers the targeted logger will be configured accordingly
This is called automatically during init
Arguments
- logger_name (
str
) - logger_confug (
dict
): see LogPluginLoggerConfig
finalize
def finalize(self, message, level)
Finalize before message is logged
Arguments
- message (
str
) - level (
str
): logging severity level
init
def init(self)
called after the plugin is initialized, plugin may define this for any other initialization code
LogPluginConfig
LogPluginConfig(ctl.plugins.PluginConfigSchema)
Configuration schema for LogPlugin
Class Attributes
- loggers (
List<LogPluginLoggerConfig>
): attach plugin to these loggers
LogPluginLoggerConfig
LogPluginLoggerConfig(confu.schema.core.Schema)
Configuration schema for LogPluginLogger
Class Attributes
- file (
Str
): configure handler to log to this file - format (
Str
): configure formatting for logger - logger (
Str
): logger name