Ligare.programming.patterns.dependency_injection
Injector dependency injection modules for extension by other modules.
Classes
|
|
|
Formatter that outputs JSON strings after parsing the LogRecord. |
|
Force all loggers to use a StreamHandler that outputs JSON |
|
- class Ligare.programming.patterns.dependency_injection.ConfigurableModule[source]
- abstract static get_config_type()[source]
- Return type:
type
[AbstractConfig
]
- class Ligare.programming.patterns.dependency_injection.JSONFormatter(fmt_dict=None, time_format='%Y-%m-%dT%H:%M:%S', msec_format='%s.%03dZ')[source]
Formatter that outputs JSON strings after parsing the LogRecord. https://stackoverflow.com/a/70223539
@param dict fmt_dict: Key: logging format attribute pairs. Defaults to {“message”: “message”}. @param str time_format: time.strftime() format string. Default: “%Y-%m-%dT%H:%M:%S” @param str msec_format: Microsecond formatting. Appended at the end. Default: “%s.%03dZ”
- __init__(fmt_dict=None, time_format='%Y-%m-%dT%H:%M:%S', msec_format='%s.%03dZ')[source]
Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.
Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting,
str.format()
({}
) formatting orstring.Template
formatting in your format string.Changed in version 3.2: Added the
style
parameter.
- format(record)[source]
Mostly the same as the parent’s class method, the difference being that a dict is manipulated and dumped as JSON instead of a string.
- Return type:
str