alogging.filters.default_fields module

class alogging.filters.default_fields.DefaultFieldsFilter(name='', defaults=None)[source]

Bases: logging.Filter

Make sure log records have a default value for the provided field/attribute

ie, if you want to use a default format string with a ‘request_id’ or ‘sql’ attribute, but not all records get those attributes added, then you could add this filter to add them

filter(record)[source]

Determine if the specified record is to be logged.

Is the specified record to be logged? Returns 0 for no, nonzero for yes. If deemed appropriate, the record may be modified in-place.