Don't attempt to set up logging to file unless logging is actually enabled.

testing/mmn/mktime_takes_localtime_not_gmtime
Isis Lovecruft 2013-05-27 07:14:03 +00:00
parent 7700b012b1
commit 30223d4203
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 2 additions and 1 deletions

View File

@ -66,13 +66,14 @@ def create_logger(level=logging.NOTSET):
_fn = os.path.join(_test, "%s_test_gnupg.log" % _now)
_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:
logging.addLevelName(GNUPG_STATUS_LEVEL, "GNUPG")
logging.Logger.status = status
if level > logging.NOTSET:
logging.basicConfig(level=level, filename=_fn,
filemode="a", format=_fmt)
logging.captureWarnings(True)
logging.logThreads = True