atk-common 1.63.0__py3-none-any.whl → 2.0.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/__init__.py +2 -0
- atk_common/bo_logger.py +41 -0
- atk_common/consumer_retry_handler.py +1 -1
- atk_common/enums/__init__.py +2 -0
- atk_common/enums/log_level_enum.py +8 -0
- {atk_common-1.63.0.dist-info → atk_common-2.0.0.dist-info}/METADATA +1 -1
- {atk_common-1.63.0.dist-info → atk_common-2.0.0.dist-info}/RECORD +10 -8
- {atk_common-1.63.0.dist-info → atk_common-2.0.0.dist-info}/WHEEL +0 -0
- {atk_common-1.63.0.dist-info → atk_common-2.0.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.63.0.dist-info → atk_common-2.0.0.dist-info}/top_level.txt +0 -0
atk_common/__init__.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# __init__.py
|
2
|
+
from atk_common.bo_logger import BoLogger
|
2
3
|
from atk_common.consumer_retry_handler import create_retry_handler
|
3
4
|
from atk_common.datetime_utils import \
|
4
5
|
get_utc_date_time, \
|
@@ -24,6 +25,7 @@ from atk_common.mq_utils import decode_message
|
|
24
25
|
from atk_common.rabbitmq_consumer import RabbitMQConsumer
|
25
26
|
|
26
27
|
__all__ = [
|
28
|
+
'BoLogger',
|
27
29
|
'create_retry_handler',
|
28
30
|
'get_utc_date_time',
|
29
31
|
'get_utc_date_time_str',
|
atk_common/bo_logger.py
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
import sys
|
2
|
+
from datetime import datetime
|
3
|
+
from atk_common.datetime_utils import get_utc_date_time_str
|
4
|
+
from atk_common.enums.log_level_enum import LogLevel
|
5
|
+
|
6
|
+
class BoLogger:
|
7
|
+
def __init__(self, log_level: LogLevel, log_url):
|
8
|
+
self.log_level = log_level
|
9
|
+
self.log_url = log_url
|
10
|
+
|
11
|
+
def set_level(self, log_level):
|
12
|
+
self.level = log_level
|
13
|
+
|
14
|
+
def _create_log_json(self, timestamp, level: LogLevel, message: str):
|
15
|
+
log_entry = {
|
16
|
+
"timestamp": timestamp,
|
17
|
+
"level": LogLevel.name(level),
|
18
|
+
"message": message
|
19
|
+
}
|
20
|
+
return log_entry
|
21
|
+
|
22
|
+
def _log(self, level: LogLevel, message: str):
|
23
|
+
if level >= self.level:
|
24
|
+
timestamp = get_utc_date_time_str()
|
25
|
+
log_json = self._create_log_json(timestamp, level, message)
|
26
|
+
print('[' + timestamp + '] ' + LogLevel.name(level) + ': ' + message)
|
27
|
+
|
28
|
+
def debug(self, message: str):
|
29
|
+
self._log(LogLevel.DEBUG, message)
|
30
|
+
|
31
|
+
def info(self, message: str):
|
32
|
+
self._log(LogLevel.INFO, message)
|
33
|
+
|
34
|
+
def warning(self, message: str):
|
35
|
+
self._log(LogLevel.WARNING, message)
|
36
|
+
|
37
|
+
def error(self, message: str):
|
38
|
+
self._log(LogLevel.ERROR, message)
|
39
|
+
|
40
|
+
def critical(self, message: str):
|
41
|
+
self._log(LogLevel.CRITICAL, message)
|
atk_common/enums/__init__.py
CHANGED
@@ -14,6 +14,7 @@ from atk_common.enums.image_encoding_type_enum import ImageEncodingType
|
|
14
14
|
from atk_common.enums.image_part_category_enum import ImagePartCategory
|
15
15
|
from atk_common.enums.image_part_type_enum import ImagePartType
|
16
16
|
from atk_common.enums.image_shelf_type_enum import ImageShelfType
|
17
|
+
from atk_common.enums.log_level_enum import LogLevel
|
17
18
|
from atk_common.enums.metering_direction_enum import MeteringDirection
|
18
19
|
from atk_common.enums.multimotor_status_type_enum import MultiMotorStatusType
|
19
20
|
from atk_common.enums.piezo_vehicle_type_enum import PiezoVehicleType
|
@@ -43,6 +44,7 @@ __all__ = [
|
|
43
44
|
'ImagePartCategory',
|
44
45
|
'ImagePartType',
|
45
46
|
'ImageShelfType',
|
47
|
+
'LogLevel',
|
46
48
|
'MeteringDirection',
|
47
49
|
'MultiMotorStatusType',
|
48
50
|
'PiezoVehicleType',
|
@@ -1,5 +1,6 @@
|
|
1
|
-
atk_common/__init__.py,sha256=
|
2
|
-
atk_common/
|
1
|
+
atk_common/__init__.py,sha256=YSwim0faSNsJ8G__eIc2QoD4P8KygxfQxF8Y2tgk_6Q,2465
|
2
|
+
atk_common/bo_logger.py,sha256=DMEielEEl1xvK9Q26AtWD3D9pCUok29z2jKnaHZEnuI,1331
|
3
|
+
atk_common/consumer_retry_handler.py,sha256=H_s9COWmjuvbzcjWxe2XpxrwfZB0j1Ns6-NO5iaxFtM,2119
|
3
4
|
atk_common/datetime_utils.py,sha256=0SC5-Nai4RJH9B0VzvGKUQts_QeRXGb7tJLlsh73LJw,3556
|
4
5
|
atk_common/db_utils.py,sha256=odUtXcS7Mumw5eGyVyVimL_U_lP7TqMX9v8nWO5nMvg,902
|
5
6
|
atk_common/default_should_retry.py,sha256=lchNA42vnB0qz26BlNA-be05p2eKv_34E6qaRce5trU,832
|
@@ -15,7 +16,7 @@ atk_common/log_utils.py,sha256=tw6Ph8oTpxrGYe_BcDTYkgrYmFAb1IxTXTodqctAIiY,504
|
|
15
16
|
atk_common/mq_utils.py,sha256=IDni2Y2AVezsJGTwPY9QPZ95b8RT8osBKHhbYcWbp_U,1131
|
16
17
|
atk_common/rabbitmq_consumer.py,sha256=4MhuwZs47Jt1fX4sUxr1MKRe7o2QRbPe9_utXEsa8QE,1907
|
17
18
|
atk_common/response_utils.py,sha256=AxlmwkFoDU5XcFOzBQiuZxAQgswihpKXHSo1T0JJw3Q,556
|
18
|
-
atk_common/enums/__init__.py,sha256=
|
19
|
+
atk_common/enums/__init__.py,sha256=hOSoKWIBUpRFaMN2tNJiel6iGI1MHj229OYnU1J8Jg0,2636
|
19
20
|
atk_common/enums/api_error_type_enum.py,sha256=9oW6ZaZ3lhMwR8r2sVNWGliS9C_jV-otiOYdezAuTp0,91
|
20
21
|
atk_common/enums/camera_cabinet_type_enum.py,sha256=U2NVrsTCBgaMRwYJamnjshAW8Y7xlOVjvUzakdgVH9A,90
|
21
22
|
atk_common/enums/camera_role_enum.py,sha256=E0TH6zXj5EA889D7UndGP7xsgg5W23SneqJCFkA6BII,82
|
@@ -38,6 +39,7 @@ atk_common/enums/image_part_type.py,sha256=tg6W9kYMRShOlsxhAJRNRdWH50gC-eF0sqvqs
|
|
38
39
|
atk_common/enums/image_part_type_enum.py,sha256=NREEtLNMVVFo-RiOWR_krUSZWRscWMCo2PHHTnZnmLg,113
|
39
40
|
atk_common/enums/image_shelf_type.py,sha256=m2-nWi83tWi-KYpTMphyt-yhK5iGNvHrJBNYjodx1P4,84
|
40
41
|
atk_common/enums/image_shelf_type_enum.py,sha256=m2-nWi83tWi-KYpTMphyt-yhK5iGNvHrJBNYjodx1P4,84
|
42
|
+
atk_common/enums/log_level_enum.py,sha256=yQstmsXRGrwvu4EI1s5AldBVtzjWDgNgiQt7dgTyuSM,128
|
41
43
|
atk_common/enums/metering_direction_enum.py,sha256=ramBPt0fK_NsToCqiYmtzDVNsLVGbeF39TmSpn_ghTY,107
|
42
44
|
atk_common/enums/multimotor_status_type_enum.py,sha256=TaoqSb6OjU17VAmFun28o8XhU3fkAKg_TQ9Kq8Y0Ff4,88
|
43
45
|
atk_common/enums/piezo_vehicle_type_enum.py,sha256=tlFk9dP7KkJVBna8SIJf6MH9zJD_szSUcDxFATJ6LZE,89
|
@@ -54,7 +56,7 @@ atk_common/enums/speed_control_status_type_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe
|
|
54
56
|
atk_common/enums/speed_control_stop_reason.py,sha256=pvLS6fpDhsCiIDAmiQBsHctxZnq-Dl2BOgJOxQnT5Hc,200
|
55
57
|
atk_common/enums/test_image_type_enum.py,sha256=HUjxJorehnzRXMNF2uHk2DrAJ3Y_ajQvp0jW-mtlOhU,140
|
56
58
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
57
|
-
atk_common-
|
59
|
+
atk_common-2.0.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
58
60
|
atk_package/__init__.py,sha256=NcsmwFadivgIeWV0-5ACZxqmfo4EzTkJX0r4N6DFAdg,820
|
59
61
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
60
62
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -67,7 +69,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
|
|
67
69
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
68
70
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
69
71
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
70
|
-
atk_common-
|
71
|
-
atk_common-
|
72
|
-
atk_common-
|
73
|
-
atk_common-
|
72
|
+
atk_common-2.0.0.dist-info/METADATA,sha256=Dp39Du66o4tWxI-qGofEhXinRpxJjADE5A24N2ul43M,1760
|
73
|
+
atk_common-2.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
74
|
+
atk_common-2.0.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
75
|
+
atk_common-2.0.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|