pgtoolkit/toolbase.py
changeset 14 a900bc629ecc
parent 13 16dc5dec9c36
child 17 f768a3529ee7
--- a/pgtoolkit/toolbase.py	Fri Sep 09 11:56:37 2011 +0200
+++ b/pgtoolkit/toolbase.py	Thu Oct 20 13:54:35 2011 +0200
@@ -22,10 +22,20 @@
     def init(self):
         self.config.load('pgtoolkit.conf')
         self.args = self.parser.parse_args()
+        self.init_logging()
+        
+    def init_logging(self):
+        # logging
+        handler = logging.StreamHandler()
+        format = ColoredFormatter(highlight(1,7,0)+'%(asctime)s %(levelname)-5s'+highlight(0)+' %(message)s', '%H:%M:%S')
+        handler.setFormatter(format)
+        handler.setLevel(logging.DEBUG)
+        self.log = logging.getLogger('main')
+        self.log.addHandler(handler)
+        self.log.setLevel(logging.DEBUG)
+        
         if self.args.debug:
             handler = logging.StreamHandler()
-            format = ColoredFormatter(
-                highlight(1,7,0)+'%(asctime)s %(levelname)-5s'+highlight(0)+' %(message)s', '%H:%M:%S')
             handler.setFormatter(format)
             handler.setLevel(logging.DEBUG)
             logger = logging.getLogger('pgmanager')