-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
62 lines (38 loc) · 999 Bytes
/
__init__.py
File metadata and controls
62 lines (38 loc) · 999 Bytes
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# pylint: disable=C0103
""" QLog logger """
import inspect
import os
from datetime import datetime
from QLog.log_entry import LogEntry
__version__ = "0.1.0"
from QLog.log_level import LogLevel
from QLog.logger import Logger
def QLogHighlight(data):
""" Log highlight """
log(LogLevel.HIGHLIGHT, data)
def QLogDebug(data):
""" Log debug """
log(LogLevel.DEBUG, data)
def QLogInfo(data):
""" Log info """
log(LogLevel.INFO, data)
def QLogWarning(data):
""" Log warning """
log(LogLevel.WARNING, data)
def QLogError(data):
""" Log error """
log(LogLevel.ERROR, data)
loggers: list[Logger] = []
def log(level: LogLevel, data):
""" log """
caller = inspect.stack()[2]
entry = LogEntry(
datetime.now(),
os.path.splitext(os.path.basename(caller.filename))[0],
caller.function,
caller.lineno,
level,
str(data)
)
for active_logger in loggers:
active_logger.log(entry)