Don't attempt to set up logging to file unless logging is actually enabled.
parent
7700b012b1
commit
30223d4203
|
@ -66,13 +66,14 @@ def create_logger(level=logging.NOTSET):
|
||||||
_fn = os.path.join(_test, "%s_test_gnupg.log" % _now)
|
_fn = os.path.join(_test, "%s_test_gnupg.log" % _now)
|
||||||
_fmt = "%(relativeCreated)-4d L%(lineno)-4d:%(funcName)-18.18s %(levelname)-7.7s %(message)s"
|
_fmt = "%(relativeCreated)-4d L%(lineno)-4d:%(funcName)-18.18s %(levelname)-7.7s %(message)s"
|
||||||
|
|
||||||
logging.basicConfig(level=level, filename=_fn, filemode="a", format=_fmt)
|
|
||||||
## Add the GNUPG_STATUS_LEVEL LogRecord to all Loggers in the module:
|
## Add the GNUPG_STATUS_LEVEL LogRecord to all Loggers in the module:
|
||||||
logging.addLevelName(GNUPG_STATUS_LEVEL, "GNUPG")
|
logging.addLevelName(GNUPG_STATUS_LEVEL, "GNUPG")
|
||||||
logging.Logger.status = status
|
logging.Logger.status = status
|
||||||
|
|
||||||
|
|
||||||
if level > logging.NOTSET:
|
if level > logging.NOTSET:
|
||||||
|
logging.basicConfig(level=level, filename=_fn,
|
||||||
|
filemode="a", format=_fmt)
|
||||||
logging.captureWarnings(True)
|
logging.captureWarnings(True)
|
||||||
logging.logThreads = True
|
logging.logThreads = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue