sawmill.formatter.template¶
-
class
sawmill.formatter.template.
Template
(template, missing_key='')[source]¶ Bases:
sawmill.formatter.base.Formatter
,string.Formatter
Format
logs
according to a template.-
ERROR
= '__ERROR__'¶
-
__init__
(template, missing_key='')[source]¶ Initialise formatter with template.
missing_key determines how to handle a missing key when formatting a log. If set to
ERROR
then an error will be raised for any key referenced in the template that is missing from the log. Any other value will be used as the substitute for the missing value. The default is an empty string.Note
The template is applied once per processed log.
-