From 8e6c6f09bb9d2f92b4427b54f5c2914833d59e99 Mon Sep 17 00:00:00 2001 From: Bastien Gandouet Date: Sun, 13 Dec 2015 18:06:37 +0100 Subject: [PATCH] Fix logging (do not touch root logger) --- pdfrw/errors.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pdfrw/errors.py b/pdfrw/errors.py index 263cd4d..ef6ab7d 100644 --- a/pdfrw/errors.py +++ b/pdfrw/errors.py @@ -9,11 +9,14 @@ import logging -logging.basicConfig( - format='[%(levelname)s] %(filename)s:%(lineno)d %(message)s', - level=logging.WARNING) +fmt = logging.Formatter('[%(levelname)s] %(filename)s:%(lineno)d %(message)s') + +handler = logging.StreamHandler() +handler.setFormatter(fmt) log = logging.getLogger('pdfrw') +log.setLevel(logging.WARNING) +log.addHandler(handler) class PdfError(Exception):