diff --git a/sanic/config.py b/sanic/config.py index 0c2cc701..ec2dd5ed 100644 --- a/sanic/config.py +++ b/sanic/config.py @@ -1,6 +1,5 @@ import os import sys -import syslog import platform import types @@ -8,6 +7,11 @@ from sanic.log import DefaultFilter SANIC_PREFIX = 'SANIC_' +try: + from syslog import LOG_DAEMON +except ImportError: + LOG_DAEMON = 24 + _address_dict = { 'Windows': ('localhost', 514), 'Darwin': '/var/run/syslog', @@ -66,7 +70,7 @@ LOGGING = { 'class': 'logging.handlers.SysLogHandler', 'address': _address_dict.get(platform.system(), ('localhost', 514)), - 'facility': syslog.LOG_DAEMON, + 'facility': LOG_DAEMON, 'filters': ['accessFilter'], 'formatter': 'access' }, @@ -74,7 +78,7 @@ LOGGING = { 'class': 'logging.handlers.SysLogHandler', 'address': _address_dict.get(platform.system(), ('localhost', 514)), - 'facility': syslog.LOG_DAEMON, + 'facility': LOG_DAEMON, 'filters': ['errorFilter'], 'formatter': 'simple' },