to fix if platform is windows.

This commit is contained in:
lanf0n 2017-09-19 18:14:25 +08:00 committed by GitHub
parent 329ebf6a5d
commit d8cebe1188

View File

@ -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'
},