main   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A main() 0 23 1
1
import logging
2
from logging.handlers import RotatingFileHandler
3
from multiprocessing import Process
4
import clean_analog_value
5
import clean_digital_value
6
import clean_energy_value
7
8
9
def main():
10
    """main"""
11
    # create logger
12
    logger = logging.getLogger('myems-cleaning')
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-cleaning.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
    # clean analog values
27
    Process(target=clean_analog_value.process, args=(logger,)).start()
28
    # clean digital values
29
    Process(target=clean_digital_value.process, args=(logger,)).start()
30
    # clean energy values
31
    Process(target=clean_energy_value.process, args=(logger,)).start()
32
33
34
if __name__ == '__main__':
35
    main()
36
37
38