Fix: logging ignores not retrievable get_native_id if not supported by OS, fixes https://github.com/Kozea/Radicale/issues/1817
This commit is contained in:
@@ -77,7 +77,13 @@ class IdentLogRecordFactory:
|
|||||||
ident += "/%s" % (record.threadName or "unknown")
|
ident += "/%s" % (record.threadName or "unknown")
|
||||||
if (sys.version_info >= (3, 8) and
|
if (sys.version_info >= (3, 8) and
|
||||||
record.thread == threading.get_ident()):
|
record.thread == threading.get_ident()):
|
||||||
|
try:
|
||||||
tid = threading.get_native_id()
|
tid = threading.get_native_id()
|
||||||
|
except AttributeError:
|
||||||
|
# so far function not existing e.g. on SunOS
|
||||||
|
# see also https://docs.python.org/3/library/threading.html#threading.get_native_id
|
||||||
|
tid = None
|
||||||
|
|
||||||
record.ident = ident # type:ignore[attr-defined]
|
record.ident = ident # type:ignore[attr-defined]
|
||||||
record.tid = tid # type:ignore[attr-defined]
|
record.tid = tid # type:ignore[attr-defined]
|
||||||
return record
|
return record
|
||||||
|
|||||||
Reference in New Issue
Block a user