ParUtils 1.2.1__py3-none-any.whl → 1.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ParUtils
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: This package contains a bunch of Python utils developed for Support, Test and Automation IT Engineers
5
5
  Home-page: https://github.com/paularnaud2/ParUtils
6
6
  Author: Paul ARNAUD
@@ -1,5 +1,5 @@
1
1
  parutils/__init__.py,sha256=EaFtUmU0kYgnjvAFwPmoKt7I5zn9bxY02R7TUtcE6M4,1434
2
- parutils/changelog.py,sha256=3uz3n01a5Vt_JhNq6OfcTKPICGesQBhPcUaD5FeWSLk,1547
2
+ parutils/changelog.py,sha256=FRy4UkSbAPMgv4bnES4tYjs8_j-u8pl9Kq26keg0ygs,1591
3
3
  parutils/csvl.py,sha256=UBqw0lyhTNqFLSNIE-JM7TAQYCRgHftYQmHi21ru8-A,2874
4
4
  parutils/dq.py,sha256=kdvzOo5FLCumXagY05kGSseYlbR-zvjjmsMtGVliVc8,2302
5
5
  parutils/file.py,sha256=-OPfMhTjHDqubZLWJquY-FOv3W_k9GWoMq_rNgtdU9Y,2881
@@ -13,11 +13,11 @@ parutils/logging/cl.py,sha256=NCLuxLHvqRTypZlAgwnegkByLTnTirKntnwguJHBelA,2086
13
13
  parutils/logging/const.py,sha256=L2OppBDAZYKUTIjsLPt6hTUh8UWH_1mX9YaGWlwzpj4,135
14
14
  parutils/logging/core.py,sha256=vBwZnpM2GRNSSABPdzEM9SRpqr_YNqdPlG3T3lNPSiY,843
15
15
  parutils/logging/g.py,sha256=ZSrgZw63kwxIW66A7-9_iYeDt4AstNZ_XXQgK8MglyQ,47
16
- parutils/logging/logger.py,sha256=XELvfvK4fB8DtbRnvlkHUnKgFnobAKGNnnkDwvUA9SM,3828
16
+ parutils/logging/logger.py,sha256=Blt-loNbEyVo83E4viX1kDeY__6_bbwzWlIyDNPFLHU,4689
17
17
  parutils/logging/main.py,sha256=arUvgB0YTZpidt4wl2GZsR4bRUj_rrSYMrTnCMKt4gA,2127
18
18
  parutils/logging/sl.py,sha256=3-sj_o33cZmOqeFxlTl5HyHOvSAhn9glYcc-BmTUpZc,1164
19
- ParUtils-1.2.1.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
20
- ParUtils-1.2.1.dist-info/METADATA,sha256=wwlE_iL727342kRMkKB6dzuLDlqN0rLoyWIROkrqc7U,5285
21
- ParUtils-1.2.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
- ParUtils-1.2.1.dist-info/top_level.txt,sha256=1MDobUcroeYEvdupZCAFvA5hJjm7LSDUV5A4jHySNis,9
23
- ParUtils-1.2.1.dist-info/RECORD,,
19
+ ParUtils-1.2.2.dist-info/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
20
+ ParUtils-1.2.2.dist-info/METADATA,sha256=s80O3PPMMmB_xSHMq4hhmYnPqqwYylAqrzbcCZLpnUs,5285
21
+ ParUtils-1.2.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
+ ParUtils-1.2.2.dist-info/top_level.txt,sha256=1MDobUcroeYEvdupZCAFvA5hJjm7LSDUV5A4jHySNis,9
23
+ ParUtils-1.2.2.dist-info/RECORD,,
parutils/changelog.py CHANGED
@@ -1,6 +1,9 @@
1
- __VERSION__ = '1.2.1'
2
- # log_dict + log_array - only one log_print -> better perfs
3
- # Improved check_log logs - name appears when nok
1
+ __VERSION__ = '1.2.2'
2
+ # log_every
3
+
4
+ # __VERSION__ = '1.2.1'
5
+ # # log_dict + log_array - only one log_print -> better perfs
6
+ # # Improved check_log logs - name appears when nok
4
7
 
5
8
  # __VERSION__ = '1.2.0'
6
9
  # # logging - error handling
@@ -21,6 +21,7 @@ class Logger:
21
21
  file_write=True,
22
22
  dir=None,
23
23
  file_format=None,
24
+ log_every=1,
24
25
  ) -> None:
25
26
  from . import g
26
27
 
@@ -35,9 +36,13 @@ class Logger:
35
36
  self.log_format = log_format if log_format else const.DEFAULT_LOG_FORMAT
36
37
  self.file_write = file_write
37
38
  self.start_time = time()
39
+
40
+ self.log_every = log_every
41
+ self.log_every_counter = 0
42
+ self.log_every_buffer = ''
43
+
38
44
  if not file_write:
39
45
  return
40
-
41
46
  self.file_label = file_label
42
47
  self.dir = dir if dir else const.DEFAULT_DIR
43
48
  self.file_format = file_format if file_format else const.DEFAULT_FILE_FORMAT
@@ -57,9 +62,13 @@ class Logger:
57
62
  self.log_print(s)
58
63
  g.logger = self
59
64
 
60
- @staticmethod
61
- def close():
65
+ def close(self):
62
66
  from . import g
67
+ if self.log_every_buffer:
68
+ self.log_every = 1
69
+ self.log_every_counter = 0
70
+ self._write_log(self.log_every_buffer, c_out=False)
71
+ self.log_every_buffer = ''
63
72
  g.logger = None
64
73
 
65
74
  def log(self, *args, level=0, c_out=True):
@@ -87,6 +96,22 @@ class Logger:
87
96
 
88
97
  if str_out:
89
98
  return s + '\n'
99
+
100
+ if self.log_every > 1:
101
+ self.log_every_counter += 1
102
+ if self.log_every_counter % self.log_every == 0:
103
+ self._write_log(self.log_every_buffer + s, c_out=False)
104
+ if c_out:
105
+ print(s)
106
+ self.log_every_buffer = ''
107
+ self.log_every_counter = 0
108
+ return
109
+ else:
110
+ self.log_every_buffer += s + '\n'
111
+ if c_out:
112
+ print(s)
113
+ return
114
+
90
115
  with lock:
91
116
  self._write_log(s, c_out)
92
117