Remove dependency on syslog module -- it won't be available under Python 2.7 under Windows.

- Legacy-Id: 4974
This commit is contained in:
Henrik Levkowetz 2012-10-30 22:17:24 +00:00
parent de5da28101
commit 8aa4922978
2 changed files with 13 additions and 4 deletions

View file

@ -5,8 +5,11 @@
# http://code.djangoproject.com/wiki/SplitSettings
import os
import syslog
syslog.openlog("datatracker", syslog.LOG_PID, syslog.LOG_USER)
try:
import syslog
syslog.openlog("datatracker", syslog.LOG_PID, syslog.LOG_USER)
except ImportError:
pass
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

View file

@ -1,6 +1,12 @@
# Copyright The IETF Trust 2007, All Rights Reserved
import syslog
try:
import syslog
write = syslog.syslog
except ImportError: # import syslog will fail on Windows boxes
import sys
write = lambda x: sys.stderr.write(x+"\n")
import inspect
import os.path
import ietf
@ -33,6 +39,6 @@ def log(msg):
where = " in " + func + "()"
except IndexError:
file, line, where = "/<UNKNOWN>", 0, ""
syslog.syslog("ietf%s(%d)%s: %s" % (file, line, where, msg))
write("ietf%s(%d)%s: %s" % (file, line, where, msg))
log("IETFdb v%s started" % ietf.__version__)