ebook_homebrew.utils.logging.AppLog.exception()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 4
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1 1
import os
2 1
import logging
3 1
from logging import config
4 1
import yaml
5
6 1
yaml_path = os.path.join(os.path.dirname(__file__), "logging.yaml")
7
8 1
with open(yaml_path) as f:
9 1
    dict_config = yaml.load(f, Loader=yaml.FullLoader)
10
11 1
config.dictConfig(dict_config)
12
13
14 1
class AppLog:
15
16 1
    logger = None
17
18 1
    def __init__(self, name):
19 1
        self.logger = logging.getLogger(name)
20
21 1
    def debug(self, msg, *args, **kwargs):
22 1
        self.logger.debug(msg, *args, **kwargs)
23
24 1
    def info(self, msg, *args, **kwargs):
25 1
        self.logger.info(msg, *args, **kwargs)
26
27 1
    def warn(self, msg, *args, **kwargs):
28 1
        self.logger.warning(msg, *args, **kwargs)
29
30 1
    def error(self, msg, *args, **kwargs):
31 1
        self.logger.error(msg, *args, **kwargs)
32
33 1
    def exception(self, msg, *args, **kwargs):
34 1
        self.logger.exception(msg, *args, **kwargs)
35
36 1
    def critical(self, msg, *args, **kwargs):
37 1
        self.logger.critical(msg, *args, **kwargs)
38
39
40 1
def get_logger(name):
41
    return AppLog(name)
42