automizor 0.4.2__py3-none-any.whl → 0.4.4__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.
- automizor/__init__.py +1 -1
- automizor/log/__init__.py +16 -16
- automizor/log/_log.py +8 -4
- {automizor-0.4.2.dist-info → automizor-0.4.4.dist-info}/METADATA +1 -1
- {automizor-0.4.2.dist-info → automizor-0.4.4.dist-info}/RECORD +8 -8
- {automizor-0.4.2.dist-info → automizor-0.4.4.dist-info}/LICENSE +0 -0
- {automizor-0.4.2.dist-info → automizor-0.4.4.dist-info}/WHEEL +0 -0
- {automizor-0.4.2.dist-info → automizor-0.4.4.dist-info}/top_level.txt +0 -0
automizor/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = "0.4.
|
1
|
+
version = "0.4.4"
|
automizor/log/__init__.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from functools import lru_cache
|
2
2
|
|
3
|
-
from ._log import
|
3
|
+
from ._log import VALUE
|
4
4
|
|
5
5
|
|
6
6
|
@lru_cache
|
@@ -10,61 +10,61 @@ def _get_log():
|
|
10
10
|
return Log()
|
11
11
|
|
12
12
|
|
13
|
-
def debug(msg:
|
13
|
+
def debug(msg: VALUE):
|
14
14
|
"""
|
15
15
|
Writes a debug log message with a level of "DEBUG".
|
16
16
|
|
17
17
|
Parameters:
|
18
|
-
msg (
|
19
|
-
|
18
|
+
msg (VALUE): The log message to write. This can be a boolean, string, integer, float
|
19
|
+
or a JSON-serializable dictionary or list.
|
20
20
|
"""
|
21
21
|
|
22
22
|
_get_log().write_log("DEBUG", msg)
|
23
23
|
|
24
24
|
|
25
|
-
def info(msg:
|
25
|
+
def info(msg: VALUE):
|
26
26
|
"""
|
27
27
|
Writes an info log message with a level of "INFO".
|
28
28
|
|
29
29
|
Parameters:
|
30
|
-
msg (
|
31
|
-
|
30
|
+
msg (VALUE): The log message to write. This can be a boolean, string, integer, float
|
31
|
+
or a JSON-serializable dictionary or list.
|
32
32
|
"""
|
33
33
|
|
34
34
|
_get_log().write_log("INFO", msg)
|
35
35
|
|
36
36
|
|
37
|
-
def warning(msg:
|
37
|
+
def warning(msg: VALUE):
|
38
38
|
"""
|
39
39
|
Writes a warning log message with a level of "WARNING".
|
40
40
|
|
41
41
|
Parameters:
|
42
|
-
msg (
|
43
|
-
|
42
|
+
msg (VALUE): The log message to write. This can be a boolean, string, integer, float
|
43
|
+
or a JSON-serializable dictionary or list.
|
44
44
|
"""
|
45
45
|
|
46
46
|
_get_log().write_log("WARNING", msg)
|
47
47
|
|
48
48
|
|
49
|
-
def error(msg:
|
49
|
+
def error(msg: VALUE):
|
50
50
|
"""
|
51
51
|
Writes an error log message with a level of "ERROR".
|
52
52
|
|
53
53
|
Parameters:
|
54
|
-
msg (
|
55
|
-
|
54
|
+
msg (VALUE): The log message to write. This can be a boolean, string, integer, float
|
55
|
+
or a JSON-serializable dictionary or list.
|
56
56
|
"""
|
57
57
|
|
58
58
|
_get_log().write_log("ERROR", msg)
|
59
59
|
|
60
60
|
|
61
|
-
def critical(msg:
|
61
|
+
def critical(msg: VALUE):
|
62
62
|
"""
|
63
63
|
Writes a critical log message with a level of "CRITICAL".
|
64
64
|
|
65
65
|
Parameters:
|
66
|
-
msg (
|
67
|
-
|
66
|
+
msg (VALUE): The log message to write. This can be a boolean, string, integer, float
|
67
|
+
or a JSON-serializable dictionary or list.
|
68
68
|
"""
|
69
69
|
|
70
70
|
_get_log().write_log("CRITICAL", msg)
|
automizor/log/_log.py
CHANGED
@@ -12,6 +12,7 @@ LOG_LEVELS = {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
JSON = Union[str, int, float, bool, None, Dict[str, "JSON"], List["JSON"]]
|
15
|
+
VALUE = Union[str, int, float, bool, JSON]
|
15
16
|
|
16
17
|
|
17
18
|
class Log:
|
@@ -34,7 +35,7 @@ class Log:
|
|
34
35
|
log.set_level("INFO")
|
35
36
|
|
36
37
|
# Write a log message
|
37
|
-
log.info(
|
38
|
+
log.info("This is an info message")
|
38
39
|
"""
|
39
40
|
|
40
41
|
def __init__(self):
|
@@ -57,15 +58,15 @@ class Log:
|
|
57
58
|
|
58
59
|
self.level = level
|
59
60
|
|
60
|
-
def write_log(self, level: str, msg:
|
61
|
+
def write_log(self, level: str, msg: VALUE):
|
61
62
|
"""
|
62
63
|
Write a log message with the specified log level.
|
63
64
|
|
64
65
|
Parameters:
|
65
66
|
level (str): The log level of the message. Valid log levels are "DEBUG", "INFO",
|
66
67
|
"WARNING", "ERROR", and "CRITICAL".
|
67
|
-
msg (
|
68
|
-
|
68
|
+
msg (VALUE): The log message to write. This can be a boolean, string, integer, float
|
69
|
+
or a JSON-serializable dictionary or list.
|
69
70
|
|
70
71
|
Raises:
|
71
72
|
ValueError: If an invalid log level is provided.
|
@@ -86,6 +87,9 @@ class Log:
|
|
86
87
|
except json.JSONDecodeError:
|
87
88
|
pass
|
88
89
|
|
90
|
+
if isinstance(msg, (dict, list)):
|
91
|
+
msg = json.dumps(msg, ensure_ascii=False)
|
92
|
+
|
89
93
|
timestamp = datetime.now(timezone.utc).isoformat()
|
90
94
|
data.append({"level": level, "msg": msg, "timestamp": timestamp})
|
91
95
|
|
@@ -1,17 +1,17 @@
|
|
1
|
-
automizor/__init__.py,sha256=
|
1
|
+
automizor/__init__.py,sha256=Qk6wsgzl7cSMWWZ902odoQ-wBV5Fda2ShX82NN7uHzM,18
|
2
2
|
automizor/exceptions.py,sha256=P5imySIOtG3ZIk2kh41Yod4RnlgTj7Vf0P3M-RuxQJs,1382
|
3
3
|
automizor/job/__init__.py,sha256=DNRuT6cyPQBaPRG4vNalCmEvcJQl-73b5ZDFOfNOwIg,1019
|
4
4
|
automizor/job/_job.py,sha256=_-ehqPwJdY89mWm3_VAuh7KRJdv-8iUu6iMAzwGLHM0,5235
|
5
|
-
automizor/log/__init__.py,sha256=
|
6
|
-
automizor/log/_log.py,sha256=
|
5
|
+
automizor/log/__init__.py,sha256=gEr2SuwN1FgX1NMnbphjg8_gfSic9L15H3WC868A-TQ,2104
|
6
|
+
automizor/log/_log.py,sha256=P9jAFXVANs5bAGH6-S0pzuSbRKEcX8VlQ_3uu690awE,2948
|
7
7
|
automizor/storage/__init__.py,sha256=bEY2R0Vk0cqscKYNnX-MM222XrxbLXOvOSBDgFmVPLo,3984
|
8
8
|
automizor/storage/_storage.py,sha256=DXcARkFZ3edoDRrDiR02zkO7LmGkRtcKTHmgPsal0lc,10989
|
9
9
|
automizor/utils/__init__.py,sha256=2trRoR5lljYKbYdxmioSlvzajjQM0Wnoq3bvF9lEZ6w,811
|
10
10
|
automizor/vault/__init__.py,sha256=UjRiW3J0R9ABXc1gXIPyS3cqNCwMWxx0l-C0PsIg7R0,1699
|
11
11
|
automizor/vault/_container.py,sha256=-2y7kASigoIVAebuQBk-0R_sI4gfmvjsMLuMg_tR1xA,1945
|
12
12
|
automizor/vault/_vault.py,sha256=uRsjOjzsstZpYwJoHNg_cpv803Dzo4T2oF6hwiG3Eww,4688
|
13
|
-
automizor-0.4.
|
14
|
-
automizor-0.4.
|
15
|
-
automizor-0.4.
|
16
|
-
automizor-0.4.
|
17
|
-
automizor-0.4.
|
13
|
+
automizor-0.4.4.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
14
|
+
automizor-0.4.4.dist-info/METADATA,sha256=ov8bVxRLQVqu-Q5opOucEST3mEOJmQbpblVy1UF3fIA,668
|
15
|
+
automizor-0.4.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
16
|
+
automizor-0.4.4.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
|
17
|
+
automizor-0.4.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|