dvlogger 2.0.2__tar.gz → 2.0.4__tar.gz

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.4
2
2
  Name: dvlogger
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: A custom logger with coloured output and uncaught exception logging. Supports threading and asyncio.
5
5
  Author-email: Pranav Mittal <pranavmittal611@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/mlpranav/dvlogger
@@ -1,4 +1,4 @@
1
- # dvlogger (v2.0.1)
1
+ # dvlogger (v2.0.4)
2
2
 
3
3
  ## Requirements
4
4
 
@@ -17,10 +17,10 @@
17
17
  import logging
18
18
  import dvlogger
19
19
 
20
- dvlogger.setup(level=logging.DEBUG, capture_warnings=True, exception_hook=True, use_tg_handler=False, use_file_handler=False, file_config=None, tg_config=None)
20
+ dvlogger.setup(level=logging.DEBUG, capture_warnings=True, exception_hook=True, use_tg_handler=False, use_file_handler=False, file_config=None, tg_config=None, log_prefix=None)
21
21
 
22
22
  dvlogger.tg_send_file(FILE_PATH, 'file_name')
23
- dvlogger.tg_send_file(FILE_OBJECT, 'file_name', 'caption', is_error=True)
23
+ dvlogger.tg_send_file(FILE_OBJECT, 'file_name', 'caption', is_error=True, log_prefix="Prod-Shard-G6")
24
24
  ```
25
25
 
26
26
  ```
@@ -300,7 +300,7 @@ class TGHandler(logging.Handler):
300
300
  class CWHandler:
301
301
  pass # integrate watchtower?
302
302
 
303
- def setup(level=logging.DEBUG, capture_warnings=True, exception_hook=True, use_tg_handler=False, use_file_handler=False, use_cw_handler=False, file_config=None, tg_config=None, cw_config=None):
303
+ def setup(level=logging.DEBUG, capture_warnings=True, exception_hook=True, use_tg_handler=False, use_file_handler=False, use_cw_handler=False, file_config=None, tg_config=None, cw_config=None, log_prefix=None):
304
304
  """
305
305
  file_config
306
306
  name [os.path.basename(sys.argv[0]).strip(), dvlogger]
@@ -344,7 +344,7 @@ def setup(level=logging.DEBUG, capture_warnings=True, exception_hook=True, use_t
344
344
  cw_config = {}
345
345
 
346
346
  colorama.init()
347
- formatter_string = '%(asctime)s.%(msecs)03d - %(threadName)s - %(taskName)s - %(levelname)s - %(filename)s.%(funcName)s#%(lineno)d - %(message)s'
347
+ formatter_string = f'{str(log_prefix) + " - " if log_prefix is not None else ""}%(asctime)s.%(msecs)03d - %(threadName)s - %(taskName)s - %(levelname)s - %(filename)s.%(funcName)s#%(lineno)d - %(message)s'
348
348
  formatter_string_date = '%Y-%m-%d %H:%M:%S'
349
349
  logging.captureWarnings(capture_warnings)
350
350
 
@@ -371,6 +371,12 @@ def setup(level=logging.DEBUG, capture_warnings=True, exception_hook=True, use_t
371
371
  asyncio.new_event_loop = asyncio_patched_new_event_loop
372
372
  policy.new_event_loop = asyncio_patched_policy_new_event_loop
373
373
 
374
+ try:
375
+ loop = asyncio.get_event_loop()
376
+ loop.set_exception_handler(asyncio_exception_handler)
377
+ except RuntimeError:
378
+ pass
379
+
374
380
  if use_file_handler:
375
381
  if file_config.get('kind', 'BASIC') == 'BASIC':
376
382
  if file_config.get("basic_put_date", False):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dvlogger
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: A custom logger with coloured output and uncaught exception logging. Supports threading and asyncio.
5
5
  Author-email: Pranav Mittal <pranavmittal611@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/mlpranav/dvlogger
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dvlogger"
7
- version = "2.0.2"
7
+ version = "2.0.4"
8
8
  description = "A custom logger with coloured output and uncaught exception logging. Supports threading and asyncio."
9
9
  authors = [
10
10
  {name = "Pranav Mittal", email = "pranavmittal611@gmail.com"},
File without changes
File without changes