Merge pull request #947 from lanfon72/patch-1

to fix if platform is windows.
This commit is contained in:
Eli Uriegas 2017-09-19 10:15:35 -07:00 committed by GitHub
commit 1b0286916e

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