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 os
import sys import sys
import syslog
import platform import platform
import types import types
@ -8,6 +7,11 @@ from sanic.log import DefaultFilter
SANIC_PREFIX = 'SANIC_' SANIC_PREFIX = 'SANIC_'
try:
from syslog import LOG_DAEMON
except ImportError:
LOG_DAEMON = 24
_address_dict = { _address_dict = {
'Windows': ('localhost', 514), 'Windows': ('localhost', 514),
'Darwin': '/var/run/syslog', 'Darwin': '/var/run/syslog',
@ -66,7 +70,7 @@ LOGGING = {
'class': 'logging.handlers.SysLogHandler', 'class': 'logging.handlers.SysLogHandler',
'address': _address_dict.get(platform.system(), 'address': _address_dict.get(platform.system(),
('localhost', 514)), ('localhost', 514)),
'facility': syslog.LOG_DAEMON, 'facility': LOG_DAEMON,
'filters': ['accessFilter'], 'filters': ['accessFilter'],
'formatter': 'access' 'formatter': 'access'
}, },
@ -74,7 +78,7 @@ LOGGING = {
'class': 'logging.handlers.SysLogHandler', 'class': 'logging.handlers.SysLogHandler',
'address': _address_dict.get(platform.system(), 'address': _address_dict.get(platform.system(),
('localhost', 514)), ('localhost', 514)),
'facility': syslog.LOG_DAEMON, 'facility': LOG_DAEMON,
'filters': ['errorFilter'], 'filters': ['errorFilter'],
'formatter': 'simple' 'formatter': 'simple'
}, },