| Total Complexity | 2 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | """Module which contains logging configuration.""" |
||
| 8 | 1 | class LoggingConfiguration: |
|
| 9 | """Contains configuration for logging.""" |
||
| 10 | |||
| 11 | 1 | @staticmethod |
|
| 12 | def init(): |
||
| 13 | """ |
||
| 14 | Initialize logging. |
||
| 15 | """ |
||
| 16 | 1 | logging.config.dictConfig(LoggingConfiguration._get_dict_config()) |
|
| 17 | 1 | LOG.debug('Logger configured successfully!') |
|
| 18 | |||
| 19 | 1 | @classmethod |
|
| 20 | def _get_dict_config(cls): |
||
| 21 | 1 | return { |
|
| 22 | 'version': 1, |
||
| 23 | 'disable_existing_loggers': False, |
||
| 24 | 'formatters': { |
||
| 25 | 'standard': { |
||
| 26 | 'format': '%(asctime)s [%(levelname)s] %(name)s %(lineno)d: %(message)s' |
||
| 27 | }, |
||
| 28 | }, |
||
| 29 | 'handlers': { |
||
| 30 | 'default': { |
||
| 31 | 'level': 'INFO', |
||
| 32 | 'formatter': 'standard', |
||
| 33 | 'class': 'logging.StreamHandler', |
||
| 34 | }, |
||
| 35 | 'file': { |
||
| 36 | 'level': 'DEBUG', |
||
| 37 | 'formatter': 'standard', |
||
| 38 | 'class': 'logging.handlers.RotatingFileHandler', |
||
| 39 | 'filename': 'grortir.log' |
||
| 40 | }, |
||
| 41 | 'file_result': { |
||
| 42 | 'level': 'INFO', |
||
| 43 | 'formatter': 'standard', |
||
| 44 | 'class': 'logging.handlers.RotatingFileHandler', |
||
| 45 | 'filename': 'grortir-results.log' |
||
| 46 | } |
||
| 47 | }, |
||
| 48 | 'loggers': { |
||
| 49 | '': { |
||
| 50 | 'handlers': ['default', 'file'], |
||
| 51 | 'level': 'DEBUG', |
||
| 52 | 'propagate': True |
||
| 53 | }, |
||
| 54 | 'results_logger': { |
||
| 55 | 'handlers': ['file_result'], |
||
| 56 | 'level': 'DEBUG', |
||
| 57 | 'propagate': True |
||
| 58 | } |
||
| 61 |