atk-common 2.0.0__py3-none-any.whl → 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- atk_common/bo_logger.py +13 -8
- {atk_common-2.0.0.dist-info → atk_common-2.2.0.dist-info}/METADATA +1 -1
- {atk_common-2.0.0.dist-info → atk_common-2.2.0.dist-info}/RECORD +6 -6
- {atk_common-2.0.0.dist-info → atk_common-2.2.0.dist-info}/WHEEL +0 -0
- {atk_common-2.0.0.dist-info → atk_common-2.2.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-2.0.0.dist-info → atk_common-2.2.0.dist-info}/top_level.txt +0 -0
atk_common/bo_logger.py
CHANGED
@@ -5,11 +5,14 @@ from atk_common.enums.log_level_enum import LogLevel
|
|
5
5
|
|
6
6
|
class BoLogger:
|
7
7
|
def __init__(self, log_level: LogLevel, log_url):
|
8
|
-
|
8
|
+
if log_level is None:
|
9
|
+
self.log_level = LogLevel.INFO.value
|
10
|
+
else:
|
11
|
+
self.log_level = log_level
|
9
12
|
self.log_url = log_url
|
10
13
|
|
11
14
|
def set_level(self, log_level):
|
12
|
-
self.
|
15
|
+
self.log_level = log_level
|
13
16
|
|
14
17
|
def _create_log_json(self, timestamp, level: LogLevel, message: str):
|
15
18
|
log_entry = {
|
@@ -20,22 +23,24 @@ class BoLogger:
|
|
20
23
|
return log_entry
|
21
24
|
|
22
25
|
def _log(self, level: LogLevel, message: str):
|
23
|
-
if level >= self.
|
26
|
+
if level >= self.log_level:
|
24
27
|
timestamp = get_utc_date_time_str()
|
25
28
|
log_json = self._create_log_json(timestamp, level, message)
|
26
29
|
print('[' + timestamp + '] ' + LogLevel.name(level) + ': ' + message)
|
30
|
+
# TODO:
|
31
|
+
# Send log_json to self.log_url via HTTP POST request (Grafana Loki or similar)
|
27
32
|
|
28
33
|
def debug(self, message: str):
|
29
|
-
self._log(LogLevel.DEBUG, message)
|
34
|
+
self._log(LogLevel.DEBUG.value, message)
|
30
35
|
|
31
36
|
def info(self, message: str):
|
32
|
-
self._log(LogLevel.INFO, message)
|
37
|
+
self._log(LogLevel.INFO.value, message)
|
33
38
|
|
34
39
|
def warning(self, message: str):
|
35
|
-
self._log(LogLevel.WARNING, message)
|
40
|
+
self._log(LogLevel.WARNING.value, message)
|
36
41
|
|
37
42
|
def error(self, message: str):
|
38
|
-
self._log(LogLevel.ERROR, message)
|
43
|
+
self._log(LogLevel.ERROR.value, message)
|
39
44
|
|
40
45
|
def critical(self, message: str):
|
41
|
-
self._log(LogLevel.CRITICAL, message)
|
46
|
+
self._log(LogLevel.CRITICAL.value, message)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
atk_common/__init__.py,sha256=YSwim0faSNsJ8G__eIc2QoD4P8KygxfQxF8Y2tgk_6Q,2465
|
2
|
-
atk_common/bo_logger.py,sha256=
|
2
|
+
atk_common/bo_logger.py,sha256=lzaXwLO1REIbKoFIEa5hEZZXkF4wqTZV6wl4T5DF6uo,1583
|
3
3
|
atk_common/consumer_retry_handler.py,sha256=H_s9COWmjuvbzcjWxe2XpxrwfZB0j1Ns6-NO5iaxFtM,2119
|
4
4
|
atk_common/datetime_utils.py,sha256=0SC5-Nai4RJH9B0VzvGKUQts_QeRXGb7tJLlsh73LJw,3556
|
5
5
|
atk_common/db_utils.py,sha256=odUtXcS7Mumw5eGyVyVimL_U_lP7TqMX9v8nWO5nMvg,902
|
@@ -56,7 +56,7 @@ atk_common/enums/speed_control_status_type_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe
|
|
56
56
|
atk_common/enums/speed_control_stop_reason.py,sha256=pvLS6fpDhsCiIDAmiQBsHctxZnq-Dl2BOgJOxQnT5Hc,200
|
57
57
|
atk_common/enums/test_image_type_enum.py,sha256=HUjxJorehnzRXMNF2uHk2DrAJ3Y_ajQvp0jW-mtlOhU,140
|
58
58
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
59
|
-
atk_common-2.
|
59
|
+
atk_common-2.2.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
60
60
|
atk_package/__init__.py,sha256=NcsmwFadivgIeWV0-5ACZxqmfo4EzTkJX0r4N6DFAdg,820
|
61
61
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
62
62
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -69,7 +69,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
|
|
69
69
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
70
70
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
71
71
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
72
|
-
atk_common-2.
|
73
|
-
atk_common-2.
|
74
|
-
atk_common-2.
|
75
|
-
atk_common-2.
|
72
|
+
atk_common-2.2.0.dist-info/METADATA,sha256=Hz1rxFAlrgsVJqrrbs04n-PJ0pNRtEEeNPZ1VP3N9_g,1760
|
73
|
+
atk_common-2.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
74
|
+
atk_common-2.2.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
75
|
+
atk_common-2.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|