20 self.pgm = pgmanager.get_instance() |
20 self.pgm = pgmanager.get_instance() |
21 |
21 |
22 def init(self): |
22 def init(self): |
23 self.config.load('pgtoolkit.conf') |
23 self.config.load('pgtoolkit.conf') |
24 self.args = self.parser.parse_args() |
24 self.args = self.parser.parse_args() |
|
25 self.init_logging() |
|
26 |
|
27 def init_logging(self): |
|
28 # logging |
|
29 handler = logging.StreamHandler() |
|
30 format = ColoredFormatter(highlight(1,7,0)+'%(asctime)s %(levelname)-5s'+highlight(0)+' %(message)s', '%H:%M:%S') |
|
31 handler.setFormatter(format) |
|
32 handler.setLevel(logging.DEBUG) |
|
33 self.log = logging.getLogger('main') |
|
34 self.log.addHandler(handler) |
|
35 self.log.setLevel(logging.DEBUG) |
|
36 |
25 if self.args.debug: |
37 if self.args.debug: |
26 handler = logging.StreamHandler() |
38 handler = logging.StreamHandler() |
27 format = ColoredFormatter( |
|
28 highlight(1,7,0)+'%(asctime)s %(levelname)-5s'+highlight(0)+' %(message)s', '%H:%M:%S') |
|
29 handler.setFormatter(format) |
39 handler.setFormatter(format) |
30 handler.setLevel(logging.DEBUG) |
40 handler.setLevel(logging.DEBUG) |
31 logger = logging.getLogger('pgmanager') |
41 logger = logging.getLogger('pgmanager') |
32 logger.addHandler(handler) |
42 logger.addHandler(handler) |
33 |
43 |