sawmill.formatter.mustache

class sawmill.formatter.mustache.Mustache(template, batch=False)[source]

Bases: sawmill.formatter.base.Formatter

Format logs using Mustache template.

__init__(template, batch=False)[source]

Initialise formatter with template.

If batch is False then the template will be applied for each log received. Otherwise all received logs will be passed to template at once under the key ‘logs’.

format(logs)[source]

Return formatted data representing logs.

If self.batch is False then each log will be passed to the template separately as the context. Otherwise, all the logs will be passed as the context.