Conditions | 1 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import logging |
||
9 | def main(): |
||
10 | """main""" |
||
11 | # create logger |
||
12 | logger = logging.getLogger('myems-normalization') |
||
13 | # specifies the lowest-severity log message a logger will handle, |
||
14 | # where debug is the lowest built-in severity level and critical is the highest built-in severity. |
||
15 | # For example, if the severity level is INFO, the logger will handle only INFO, WARNING, ERROR, and CRITICAL |
||
16 | # messages and will ignore DEBUG messages. |
||
17 | logger.setLevel(logging.ERROR) |
||
18 | # create file handler which logs messages |
||
19 | fh = RotatingFileHandler('myems-normalization.log', maxBytes=1024*1024, backupCount=1) |
||
20 | # create formatter and add it to the handlers |
||
21 | formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
||
22 | fh.setFormatter(formatter) |
||
23 | # add the handlers to logger |
||
24 | logger.addHandler(fh) |
||
25 | |||
26 | # calculate energy consumption in hourly period |
||
27 | Process(target=meter.calculate_hourly, args=(logger,)).start() |
||
28 | Process(target=virtualmeter.calculate_hourly, args=(logger,)).start() |
||
29 | Process(target=offlinemeter.calculate_hourly, args=(logger,)).start() |
||
30 | |||
36 |