-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.py
38 lines (29 loc) · 879 Bytes
/
logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The logger class, which manages the logging in
whole application. It is inhertaed in all other moudles.
This uses python standard logging class with small changes.
"""
import logging
class Logger:
def __init__(self, level="ERROR"):
self.logger = logging
self.logger.basicConfig(
format='%(levelname)s:%(message)s',
level=self.logging_level(level))
def get_logger(self):
"""
Gets the Logger
"""
return self.logger
def logging_level(self, level):
if (level == "DEBUG"):
log_level = logging.DEBUG
elif (level == "INFO"):
log_level = logging.INFO
elif (level == "WARNING"):
log_level = logging.WARNING
else:
log_level = logging.ERROR
return log_level