-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo_me.py
31 lines (24 loc) · 868 Bytes
/
info_me.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
# create useful logger
import logging, sys
from types import MappingProxyType
class report_logs():
__slots__ = ["print_loggy","set_logs"]
def __init__(self) -> None:
self.print_loggy = logging.StreamHandler(sys.stdout)
self.print_loggy.setFormatter(
logging.Formatter(
"{asctime} {levelname}: {message}",
"%d.%m.%y %I:%M:%S", style="{"
)
)
self.set_logs = logging.getLogger()
self.set_logs.addHandler(self.print_loggy)
self.set_logs.setLevel(logging.DEBUG)
def ins_logs(self, a, b):
logs = MappingProxyType({
"e": logging.error,
"w": logging.warning,
"c": logging.critical,
"i": logging.info
})
return logs[a]("\t" + b)