compass.utilities.logs.AddLocationFilter#

class AddLocationFilter(name='')[source]#

Bases: Filter

Filter that injects location information into the log record

Initialize a filter.

Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.

Methods

filter(record)

Add location to record

filter(record)[source]#

Add location to record

Parameters:

record (logging.LogRecord) – Log record containing the log message + default attributes. This filter will add the location bing processed as a location attribute. If the there is no current async task (or if the task name is of the form “Task-XX”), the filter sets the location to “main”.

Returns:

bool – Always true since we want the record to be passed along with the additional attribute.