In some cases, the code to show the location of a logging statement failed with an exception, resulting in no logging. Catch this, so something is logged.
- Legacy-Id: 1716
This commit is contained in:
parent
58e716c2cd
commit
632a588e72
|
@ -21,13 +21,16 @@ def getcaller():
|
|||
return (pmodule, pclass, pfunction, pfile, pline)
|
||||
|
||||
def log(msg):
|
||||
mod, cls, func, file, line = getcaller()
|
||||
file = os.path.abspath(file)
|
||||
file = file.replace(settings.BASE_DIR, "")
|
||||
if func == "<module>":
|
||||
where = ""
|
||||
else:
|
||||
where = " in " + func + "()"
|
||||
try:
|
||||
mod, cls, func, file, line = getcaller()
|
||||
file = os.path.abspath(file)
|
||||
file = file.replace(settings.BASE_DIR, "")
|
||||
if func == "<module>":
|
||||
where = ""
|
||||
else:
|
||||
where = " in " + func + "()"
|
||||
except IndexError:
|
||||
file, line, where = "/<UNKNOWN>", 0, ""
|
||||
syslog.syslog("ietf%s(%d)%s: %s" % (file, line, where, msg))
|
||||
|
||||
log("IETFdb v%s started" % ietf.__version__)
|
||||
|
|
Loading…
Reference in a new issue