From ac9fa73b5421a3884ec4a1df6a1a5688dd7b463d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Wed, 3 May 2006 20:50:16 +0000 Subject: [PATCH] * fix: make the other levels work * clean up the log without calling logging.shutdown(), this should make it possible to mix pisi logger with other loggers, and make it properly re-entrant. so much for an easy to use api! --- pisi/api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index ae4f87c7..f8a71d8f 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -70,11 +70,13 @@ def init(database = True, write = True, if os.access('/var/log', os.W_OK): handler = logging.handlers.RotatingFileHandler('/var/log/pisi.log') - handler.setLevel(logging.DEBUG) + #handler.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)-12s: %(levelname)-8s %(message)s') handler.setFormatter(formatter) ctx.log = logging.getLogger('pisi') ctx.log.addHandler(handler) + ctx.loghandler = handler + ctx.log.setLevel(logging.DEBUG) else: ctx.log = None @@ -116,7 +118,8 @@ def finalize(): if ctx.initialized: if ctx.log: - logging.shutdown() + ctx.loghandler.flush() + ctx.log.removeHandler(ctx.loghandler) pisi.repodb.finalize() pisi.installdb.finalize()