Conditions | 2 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | # -*- coding: utf-8 -*- |
||
15 | def setup(): |
||
16 | if not os.path.isdir(logfolder): |
||
17 | os.mkdir(logfolder) |
||
18 | |||
19 | logger = logging.getLogger('condamanager') |
||
20 | logger.setLevel(logging.DEBUG) |
||
21 | |||
22 | # ch = logging.handlers.RotatingFileHandler(logfile, maxBytes=2*1024*1024, |
||
23 | # backupCount=5, mode='w') |
||
24 | ch = logging.FileHandler(logfile, mode='w') |
||
25 | ch.setLevel(logging.DEBUG) |
||
26 | |||
27 | f = ('%(asctime)s - %(levelname)s\n' |
||
28 | ' %(module)s.%(funcName)s : %(lineno)d\n' |
||
29 | ' %(message)s\n') |
||
30 | formatter = logging.Formatter(f) |
||
31 | ch.setFormatter(formatter) |
||
32 | |||
33 | logger.addHandler(ch) |
||
34 | |||
35 | logger.info('Setting up logger') |
||
36 | return logger |
||
37 | |||
39 |