summaryrefslogtreecommitdiff
blob: 52acf04171d8bce24556a64378b2160eef32d0b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- rst2pdf/log.py
+++ rst2pdf/log.py
@@ -4,11 +4,12 @@
 import logging
 import sys
 
-logging.basicConfig(
-    format='[%(levelname)s] %(filename)s:%(lineno)d %(message)s',
-    level=logging.WARNING)
-
 log = logging.getLogger('rst2pdf')
+_fmt = logging.Formatter('[%(levelname)s] %(filename)s:%(lineno)d %(message)s')
+_hdlr = logging.StreamHandler()
+_hdlr.setFormatter(_fmt)
+log.addHandler(_hdlr)
+log.setLevel(logging.WARNING)
 
 def nodeid(node):
     """Given a node, tries to return a way to see where it was in the 
@@ -23,4 +24,4 @@
         if node.source: fname=str(node.source)
     except:
         pass
-    return 'near line %s in file %s'%(line,fname)
\ No newline at end of file
+    return 'near line %s in file %s'%(line,fname)