atomicshop 2.16.27__py3-none-any.whl → 2.16.28__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.

Potentially problematic release.


This version of atomicshop might be problematic. Click here for more details.

atomicshop/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '2.16.27'
4
+ __version__ = '2.16.28'
atomicshop/print_api.py CHANGED
@@ -2,6 +2,7 @@ import sys
2
2
  import logging
3
3
 
4
4
  from .basics.ansi_escape_codes import ColorsBasic, get_colors_basic_dict
5
+ from .wrappers.loggingw import handlers
5
6
  from .basics import tracebacks
6
7
 
7
8
 
@@ -125,14 +126,16 @@ def print_api(
125
126
  original_formatter = None
126
127
 
127
128
  # Find the stream handler and change its formatter
129
+ # noinspection PyUnresolvedReferences
128
130
  for handler in logger.handlers:
129
131
  if isinstance(handler, logging.StreamHandler):
130
132
  # Save the original formatter
131
133
  original_formatter = handler.formatter
134
+ original_formatter_string = handlers.get_formatter_string(handler)
132
135
 
133
136
  # Create a colored formatter for errors
134
137
  color_formatter = logging.Formatter(
135
- get_colors_basic_dict(color) + original_formatter + ColorsBasic.END)
138
+ get_colors_basic_dict(color) + original_formatter_string + ColorsBasic.END)
136
139
  handler.setFormatter(color_formatter)
137
140
 
138
141
  # If 'online' is set to 'True', we'll output message as oneline.
@@ -151,6 +154,7 @@ def print_api(
151
154
 
152
155
  if stdcolor:
153
156
  # Restore the original formatter after logging
157
+ # noinspection PyUnresolvedReferences
154
158
  for handler in logger.handlers:
155
159
  if isinstance(handler, logging.StreamHandler):
156
160
  handler.setFormatter(original_formatter)
@@ -155,3 +155,15 @@ def get_logging_formatter_from_string(
155
155
  return NanosecondsFormatter(formatter, style=style, datefmt=datefmt, use_nanoseconds=use_nanoseconds)
156
156
  else:
157
157
  return logging.Formatter(formatter, style=style, datefmt=datefmt)
158
+
159
+
160
+ def get_formatter_string(formatter) -> str:
161
+ """
162
+ Function to get the formatter string from the 'logging.Formatter'.
163
+
164
+ :param formatter: logging.Formatter, formatter to convert to string.
165
+ :return: str, formatter string.
166
+ """
167
+
168
+ # noinspection PyProtectedMember
169
+ return formatter._fmt
@@ -472,3 +472,13 @@ def add_filter_to_handler(handler: logging.Handler, filter_object: logging.Filte
472
472
  """
473
473
 
474
474
  handler.addFilter(filter_object)
475
+
476
+
477
+ def get_formatter_string(handler: logging.Handler) -> str:
478
+ """
479
+ Function to get the formatter string from the handler.
480
+ :param handler: Handler to get the formatter from.
481
+ :return: Formatter string.
482
+ """
483
+
484
+ return formatters.get_formatter_string(handler.formatter)
@@ -317,7 +317,8 @@ class ExceptionCsvLogger:
317
317
  def write(
318
318
  self,
319
319
  message: Union[str, Exception] = None,
320
- custom_csv_string: str = None
320
+ custom_csv_string: str = None,
321
+ stdout: bool = True
321
322
  ):
322
323
  """
323
324
  Write the message to the log file.
@@ -330,6 +331,7 @@ class ExceptionCsvLogger:
330
331
  Meaning, that you need to provide the 'custom_header' during the initialization of the object.
331
332
  Off course, you can use as many commas as you need in the 'custom_csv_string': "custom1,custom2,custom3".
332
333
  This need to be mirrored in the 'custom_header' as well: "custom1,custom2,custom3".
334
+ :param stdout: If set to True, the exception will be printed to the console.
333
335
  """
334
336
 
335
337
  if message is None or isinstance(message, Exception):
@@ -348,7 +350,9 @@ class ExceptionCsvLogger:
348
350
  "Number of cells in the 'output_csv_line' doesn't match the number of cells in the 'header'.")
349
351
 
350
352
  self.logger.info(output_csv_line)
351
- print_api('', error_type=True, color="red", traceback_string=True)
353
+
354
+ if stdout:
355
+ print_api('', error_type=True, color="red", traceback_string=True)
352
356
 
353
357
  def get_logger(self):
354
358
  return self.logger
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.16.27
3
+ Version: 2.16.28
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=uvGTfzSHIYxELvSkSy25hxKozcYi2WpTk6bDs1_wXVs,124
1
+ atomicshop/__init__.py,sha256=RKrFOzhIp5E7tjs7oJStRgnGRfLQJGazFO71-p0tK_o,124
2
2
  atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
3
3
  atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
4
4
  atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
@@ -25,7 +25,7 @@ atomicshop/ip_addresses.py,sha256=Hvi4TumEFoTEpKWaq5WNF-YzcRzt24IxmNgv-Mgax1s,11
25
25
  atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,452
26
26
  atomicshop/on_exit.py,sha256=Rpg2SaF0aginuO7JYwA49YJYnS8F6K2jUqhjH65WzuU,6889
27
27
  atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
28
- atomicshop/print_api.py,sha256=37zugPqm04XFLmMnXxNo0bJtv1ImNSDHosPTlOuYyhw,12760
28
+ atomicshop/print_api.py,sha256=Bny4BpkD9dwa8FRTKAibTLMWJp38M9BsVrOpJNFSWTw,13010
29
29
  atomicshop/process.py,sha256=PeLvyixXaCfftdUF3oMbohI1L4MdLtvQVDx2V1Tz_Rk,16662
30
30
  atomicshop/python_file_patcher.py,sha256=-uhbUX-um5k-If_XXuOfCr8wMzZ3QE6h9N8xGWw6W_o,5486
31
31
  atomicshop/python_functions.py,sha256=zJg4ogUwECxrDD7xdDN5JikIUctITM5lsyabr_ZNsRw,4435
@@ -246,10 +246,10 @@ atomicshop/wrappers/fibratusw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
246
246
  atomicshop/wrappers/fibratusw/install.py,sha256=PLVymDe0HuOvU0r2lje8BkQAgtiOWEeRO7n-1zKuL7A,3287
247
247
  atomicshop/wrappers/loggingw/consts.py,sha256=JWiUJEydjhwatBxtIJsGTmDUSTLbmIRidtR6qRLMaIY,1608
248
248
  atomicshop/wrappers/loggingw/filters.py,sha256=CMs5PAMb68zxJgBcQobaOFDG5kLJBOVYnoBHjDgksO8,2859
249
- atomicshop/wrappers/loggingw/formatters.py,sha256=7XUJvlB0CK4DCkEp8NTL0S0dkyrZD0UTADgEwkStKOY,5483
250
- atomicshop/wrappers/loggingw/handlers.py,sha256=hAPFJQ-wFoNO8QzGrJRSvyuP09Q1F0Dl9_w7zzlgcW0,18155
249
+ atomicshop/wrappers/loggingw/formatters.py,sha256=ZY12IokVY1G_Wzn2Zlv9qjK-e8CtIK6yUgUfPHvH2BU,5802
250
+ atomicshop/wrappers/loggingw/handlers.py,sha256=AsltQH17cAhgexVaR2TJtSaD2Xlw8QNiv_hKIo6ZF7s,18450
251
251
  atomicshop/wrappers/loggingw/loggers.py,sha256=mmM__XR3W4QC82wbsDRG_M4_0JYGGEP0Qn0WCOSp-go,2910
252
- atomicshop/wrappers/loggingw/loggingw.py,sha256=oqH_u1AFyu4YG468ZDnCalRNNu2438AEYZa2MFB9iqg,16143
252
+ atomicshop/wrappers/loggingw/loggingw.py,sha256=OTar1pwc-qxPal2yMjMvK1rzvtpcQzVwTxSckt-90_Q,16289
253
253
  atomicshop/wrappers/loggingw/reading.py,sha256=ERBSiQbEksySKpXpu2E_6k9dZ6MPH95ZIsmdjWW9MUE,16436
254
254
  atomicshop/wrappers/mongodbw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
255
255
  atomicshop/wrappers/mongodbw/install_mongodb.py,sha256=3ZPqrXxj3lC-PnAKGXclylLuOqsbyXYeUpb5iGjdeUU,6626
@@ -309,8 +309,8 @@ atomicshop/wrappers/socketw/ssl_base.py,sha256=kmiif84kMhBr5yjQW17p935sfjR5JKG0L
309
309
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=w1AH-zf4mBuT4euf28UKij9ihM-b1BRU9Qfby0QDdqI,2957
310
310
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
311
311
  atomicshop/wrappers/winregw/winreg_network.py,sha256=bQ8Jql8bVGBJ0dt3VQ56lga_1LBOMLI3Km_otvvbU6c,7138
312
- atomicshop-2.16.27.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
313
- atomicshop-2.16.27.dist-info/METADATA,sha256=JD7sHdbqBZwiuJmXdvhYXs4qgSy5S5riQpv0m6lAMKU,10473
314
- atomicshop-2.16.27.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
315
- atomicshop-2.16.27.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
316
- atomicshop-2.16.27.dist-info/RECORD,,
312
+ atomicshop-2.16.28.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
313
+ atomicshop-2.16.28.dist-info/METADATA,sha256=dd_ZbiMXylLwEVatyDQXjaRPx_RJRFbOtELFjVKRYzk,10473
314
+ atomicshop-2.16.28.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
315
+ atomicshop-2.16.28.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
316
+ atomicshop-2.16.28.dist-info/RECORD,,