Completed
Push — master ( 1ad3a4...9b26dc )
by Wojtek
02:35
created

LoggingConfiguration._get_dict_config()   B

Complexity

Conditions 1

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 28
ccs 2
cts 2
cp 1
crap 1
rs 8.8571
1
"""Module which contains logging configuration."""
2
# pylint: disable=line-too-long
0 ignored issues
show
introduced by
Locally disabling line-too-long (C0301)
Loading history...
3 1
import logging.config
4
5
6 1
class LoggingConfiguration:
7
    """Contains configuration for logging."""
8
9 1
    @staticmethod
10
    def init():
11
        """
12
        Initialize logging.
13
        """
14 1
        logging.config.dictConfig(LoggingConfiguration._get_dict_config())
15
16 1
    @classmethod
17
    def _get_dict_config(cls):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
18 1
        return {
19
            'version': 1,
20
            'disable_existing_loggers': False,
21
            'formatters': {
22
                'standard': {
23
                    'format': '%(asctime)s [%(levelname)s] %(name)s %(lineno)d: %(message)s'
24
                },
25
            },
26
            'handlers': {
27
                'default': {
28
                    'level': 'INFO',
29
                    'formatter': 'standard',
30
                    'class': 'logging.StreamHandler',
31
                },
32
                'file': {
33
                    'level': 'DEBUG',
34
                    'formatter': 'standard',
35
                    'class': 'logging.handlers.RotatingFileHandler',
36
                    'filename': 'grortir.log'
37
                }
38
            },
39
            'loggers': {
40
                '': {
41
                    'handlers': ['default', 'file'],
42
                    'level': 'DEBUG',
43
                    'propagate': True
44
                }
45
            }
46
        }
47