fix syslog in 2.6

socktype is only supported in 2,7 and sup.

fix #541
This commit is contained in:
benoitc 2013-06-24 09:39:43 +02:00
parent 4e0ffa0bd1
commit 8dbfab5556

View File

@ -363,8 +363,15 @@ class Logger(object):
socktype, addr = parse_syslog_address(cfg.syslog_addr)
# finally setup the syslog handler
h = logging.handlers.SysLogHandler(address=addr, facility=facility,
socktype=socktype)
if sys.version_info >= (2, 7):
h = logging.handlers.SysLogHandler(address=addr,
facility=facility, socktype=socktype)
else:
# socktype is only supported in 2.7 and sup
# fix issue #541
h = logging.handlers.SysLogHandler(address=addr,
facility=facility)
h.setFormatter(fmt)
h._gunicorn = True
log.addHandler(h)