automizor 0.4.1__py3-none-any.whl → 0.4.3__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 CHANGED
@@ -1 +1 @@
1
- version = "0.4.1"
1
+ version = "0.4.3"
automizor/log/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from functools import lru_cache
2
2
 
3
- from ._log import JSON
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: JSON):
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 (JSON): The log message to write. This can be a string, number, boolean, dictionary,
19
- list, or None.
18
+ msg (VALUE): The log message to write. This can be a boolean, string, bytes, integer,
19
+ or float value.
20
20
  """
21
21
 
22
22
  _get_log().write_log("DEBUG", msg)
23
23
 
24
24
 
25
- def info(msg: JSON):
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 (JSON): The log message to write. This can be a string, number, boolean, dictionary,
31
- list, or None.
30
+ msg (VALUE): The log message to write. This can be a boolean, string, bytes, integer,
31
+ or float value.
32
32
  """
33
33
 
34
34
  _get_log().write_log("INFO", msg)
35
35
 
36
36
 
37
- def warning(msg: JSON):
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 (JSON): The log message to write. This can be a string, number, boolean, dictionary,
43
- list, or None.
42
+ msg (VALUE): The log message to write. This can be a boolean, string, bytes, integer,
43
+ or float value.
44
44
  """
45
45
 
46
46
  _get_log().write_log("WARNING", msg)
47
47
 
48
48
 
49
- def error(msg: JSON):
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 (JSON): The log message to write. This can be a string, number, boolean, dictionary,
55
- list, or None.
54
+ msg (VALUE): The log message to write. This can be a boolean, string, bytes, integer,
55
+ or float value.
56
56
  """
57
57
 
58
58
  _get_log().write_log("ERROR", msg)
59
59
 
60
60
 
61
- def critical(msg: JSON):
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 (JSON): The log message to write. This can be a string, number, boolean, dictionary,
67
- list, or None.
66
+ msg (VALUE): The log message to write. This can be a boolean, string, bytes, integer,
67
+ or float value.
68
68
  """
69
69
 
70
70
  _get_log().write_log("CRITICAL", msg)
automizor/log/_log.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import json
2
2
  import os
3
- from typing import Dict, List, Union
3
+ from datetime import datetime, timezone
4
+ from typing import Union
4
5
 
5
6
  LOG_LEVELS = {
6
7
  "DEBUG": 1,
@@ -10,7 +11,7 @@ LOG_LEVELS = {
10
11
  "CRITICAL": 5,
11
12
  }
12
13
 
13
- JSON = Union[str, int, float, bool, None, Dict[str, "JSON"], List["JSON"]]
14
+ VALUE = Union[bool, str, bytes, int, float]
14
15
 
15
16
 
16
17
  class Log:
@@ -33,7 +34,7 @@ class Log:
33
34
  log.set_level("INFO")
34
35
 
35
36
  # Write a log message
36
- log.info({"key": "value"})
37
+ log.info("This is an info message")
37
38
  """
38
39
 
39
40
  def __init__(self):
@@ -56,15 +57,15 @@ class Log:
56
57
 
57
58
  self.level = level
58
59
 
59
- def write_log(self, level: str, msg: JSON):
60
+ def write_log(self, level: str, msg: VALUE):
60
61
  """
61
62
  Write a log message with the specified log level.
62
63
 
63
64
  Parameters:
64
65
  level (str): The log level of the message. Valid log levels are "DEBUG", "INFO",
65
66
  "WARNING", "ERROR", and "CRITICAL".
66
- msg (JSON): The log message to write. This can be a string, number, boolean, dictionary,
67
- list, or None.
67
+ msg (VALUE): The log message to write. This can be a boolean, string, bytes, integer,
68
+ or float value.
68
69
 
69
70
  Raises:
70
71
  ValueError: If an invalid log level is provided.
@@ -85,7 +86,8 @@ class Log:
85
86
  except json.JSONDecodeError:
86
87
  pass
87
88
 
88
- data.append({"level": level, "msg": msg})
89
+ timestamp = datetime.now(timezone.utc).isoformat()
90
+ data.append({"level": level, "msg": msg, "timestamp": timestamp})
89
91
 
90
92
  with open(file_path, "w", encoding="utf-8") as file:
91
93
  json.dump(data, file, ensure_ascii=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: automizor
3
- Version: 0.4.1
3
+ Version: 0.4.3
4
4
  Summary: Python Automizor framework
5
5
  Home-page: https://github.com/automizor/automizor-python
6
6
  Author: Christian Fischer
@@ -1,17 +1,17 @@
1
- automizor/__init__.py,sha256=FBeN5tbWV0BpBmjJ3d3pzaNRlEg_Blp421Tbg8X3cAI,18
1
+ automizor/__init__.py,sha256=qGkDKQTrLXZ0o-aafthub4OFvdwOI_7GN29zXzZj8zg,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=SVCIoKAQfXMIb99_204dgSqFSHO9T74RXpTZq33akKc,1978
6
- automizor/log/_log.py,sha256=CI40pFMhSymeIcBFUoW3zIvYd2WMLDxekNapNIra62M,2651
5
+ automizor/log/__init__.py,sha256=YPATqeIvTk2xuk-pj0T-RmBKTLH9dT-Xyj61G3dph38,1974
6
+ automizor/log/_log.py,sha256=gZp_5Sti8fkVHYsQbXRVb6F38uWexoG-x6oP9M0E2wM,2739
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.1.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
14
- automizor-0.4.1.dist-info/METADATA,sha256=aEGhSTMMVvV0XGcs2edBG3bhjHl8UAEu1Pe2ecN7EuU,668
15
- automizor-0.4.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
16
- automizor-0.4.1.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
17
- automizor-0.4.1.dist-info/RECORD,,
13
+ automizor-0.4.3.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
14
+ automizor-0.4.3.dist-info/METADATA,sha256=GA2unz9bHe21Z7RlzNiwcJEj1ILOn17IufrevjY-4x8,668
15
+ automizor-0.4.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
16
+ automizor-0.4.3.dist-info/top_level.txt,sha256=gScDy4I3tP6BMYAsTAlBXrxVh3E00zV0UioxwXJOI3Y,10
17
+ automizor-0.4.3.dist-info/RECORD,,