alogging.filters.django_sql_slow_queries module

class alogging.filters.django_sql_slow_queries.DjangoDbSqlSlowQueriesFilter(name='', min_duration=0.04)[source]

Bases: logging.Filter

Filter to log only “slow” sql queries

Default is to only show queries that take more than 40ms

The min_duration init arg is in seconds. Default is 0.04s (40ms)

Add this filter to handlers that get log records from ‘django.db’ loggers.

See django_sql_slow_queries_example.yaml for yaml setup.

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.