Total Complexity | 5 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
2 | # -*- coding: future_fstrings -*- |
||
3 | |||
4 | """ |
||
5 | Log script |
||
6 | """ |
||
7 | |||
8 | import logging |
||
9 | from db_sync_tool.utility import system |
||
10 | |||
11 | # |
||
12 | # GLOBALS |
||
13 | # |
||
14 | |||
15 | logger = None |
||
|
|||
16 | |||
17 | |||
18 | # |
||
19 | # FUNCTIONS |
||
20 | # |
||
21 | |||
22 | |||
23 | def init_logger(): |
||
24 | """ |
||
25 | Initialize the logger instance |
||
26 | :return: |
||
27 | """ |
||
28 | global logger |
||
29 | logger = logging.getLogger('db_sync_tool') |
||
30 | logger.setLevel(logging.DEBUG) |
||
31 | |||
32 | if system.config: |
||
33 | if 'log_file' in system.config: |
||
34 | fh = logging.FileHandler(system.config['log_file']) |
||
35 | fh.setLevel(logging.DEBUG) |
||
36 | logger.addHandler(fh) |
||
37 | formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') |
||
38 | fh.setFormatter(formatter) |
||
39 | logger.addHandler(fh) |
||
40 | |||
41 | |||
42 | def get_logger(): |
||
43 | """ |
||
44 | Return the logger instance |
||
45 | :return: |
||
46 | """ |
||
47 | if logger is None: |
||
48 | init_logger() |
||
49 | return logger |
||
50 |
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.