diff --git a/docs/sanic/logging.md b/docs/sanic/logging.md index fae8c5ad..e0f0c318 100644 --- a/docs/sanic/logging.md +++ b/docs/sanic/logging.md @@ -85,11 +85,11 @@ By default, log_config parameter is set to use sanic.config.LOGGING dictionary f And `filters`: -- accessFilter (using sanic.default_filter.DefaultFilter)
+- accessFilter (using sanic.logging.DefaultFilter)
The filter that allows only levels in `DEBUG`, `INFO`, and `NONE(0)` -- errorFilter (using sanic.default_filter.DefaultFilter)
+- errorFilter (using sanic.logging.DefaultFilter)
The filter that allows only levels in `WARNING`, `ERROR`, and `CRITICAL` There are two `loggers` used in sanic, and **must be defined if you want to create your own logging configuration**: diff --git a/sanic/config.py b/sanic/config.py index 3cf8f1ec..461b1a59 100644 --- a/sanic/config.py +++ b/sanic/config.py @@ -4,7 +4,7 @@ import syslog import platform import types -from sanic.default_filter import DefaultFilter +from sanic.logging import DefaultFilter SANIC_PREFIX = 'SANIC_' diff --git a/sanic/default_filter.py b/sanic/default_filter.py deleted file mode 100644 index 9e9508ec..00000000 --- a/sanic/default_filter.py +++ /dev/null @@ -1,13 +0,0 @@ -import logging - - -class DefaultFilter(logging.Filter): - def __init__(self, param=None): - self.param = param - - def filter(self, record): - if self.param is None: - return True - if record.levelno in self.param: - return True - return False diff --git a/sanic/log.py b/sanic/log.py index cce4a64f..760ad1c6 100644 --- a/sanic/log.py +++ b/sanic/log.py @@ -1,4 +1,18 @@ import logging + +class DefaultFilter(logging.Filter): + + def __init__(self, param=None): + self.param = param + + def filter(self, record): + if self.param is None: + return True + if record.levelno in self.param: + return True + return False + + log = logging.getLogger('sanic') netlog = logging.getLogger('network')