dvlogger 2.0.5__tar.gz → 2.0.7__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.
- {dvlogger-2.0.5 → dvlogger-2.0.7}/PKG-INFO +1 -1
- {dvlogger-2.0.5 → dvlogger-2.0.7}/README.md +1 -1
- {dvlogger-2.0.5 → dvlogger-2.0.7}/dvlogger/logconfig.py +10 -5
- {dvlogger-2.0.5 → dvlogger-2.0.7}/dvlogger.egg-info/PKG-INFO +1 -1
- {dvlogger-2.0.5 → dvlogger-2.0.7}/pyproject.toml +1 -1
- {dvlogger-2.0.5 → dvlogger-2.0.7}/dvlogger/__init__.py +0 -0
- {dvlogger-2.0.5 → dvlogger-2.0.7}/dvlogger.egg-info/SOURCES.txt +0 -0
- {dvlogger-2.0.5 → dvlogger-2.0.7}/dvlogger.egg-info/dependency_links.txt +0 -0
- {dvlogger-2.0.5 → dvlogger-2.0.7}/dvlogger.egg-info/requires.txt +0 -0
- {dvlogger-2.0.5 → dvlogger-2.0.7}/dvlogger.egg-info/top_level.txt +0 -0
- {dvlogger-2.0.5 → dvlogger-2.0.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dvlogger
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.7
|
|
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
|
|
@@ -168,7 +168,7 @@ class TGHandler(logging.Handler):
|
|
|
168
168
|
if thread_id is not None:
|
|
169
169
|
data += f'--{boundary}\r\nContent-Disposition: form-data; name="message_thread_id"\r\n\r\n{thread_id}\r\n'
|
|
170
170
|
if caption or self.log_prefix:
|
|
171
|
-
data += f'--{boundary}\r\nContent-Disposition: form-data; name="caption"\r\n\r\n{self.log_prefix + " - " if
|
|
171
|
+
data += f'--{boundary}\r\nContent-Disposition: form-data; name="caption"\r\n\r\n{self.log_prefix + " - " if caption else ""}{caption}\r\n'
|
|
172
172
|
data += (
|
|
173
173
|
f'--{boundary}\r\n'
|
|
174
174
|
f'Content-Disposition: form-data; name="document"; filename="{filename}"\r\n'
|
|
@@ -185,7 +185,7 @@ class TGHandler(logging.Handler):
|
|
|
185
185
|
},
|
|
186
186
|
)
|
|
187
187
|
|
|
188
|
-
def send_file(self, file, name, caption='', is_error=False):
|
|
188
|
+
def send_file(self, file, name=None, caption='', is_error=False):
|
|
189
189
|
chat_id = self.chat_id
|
|
190
190
|
thread_id = self.thread_id
|
|
191
191
|
if is_error and self.error_chat_id is not None:
|
|
@@ -197,10 +197,14 @@ class TGHandler(logging.Handler):
|
|
|
197
197
|
if isinstance(file, str):
|
|
198
198
|
with open(file, 'rb') as f:
|
|
199
199
|
filedata = f.read()
|
|
200
|
+
if name is None:
|
|
201
|
+
name = os.path.basename(file)
|
|
200
202
|
elif hasattr(file, 'read'):
|
|
201
203
|
filedata = file.read()
|
|
202
204
|
if isinstance(filedata, str):
|
|
203
205
|
filedata = filedata.encode()
|
|
206
|
+
if name is None:
|
|
207
|
+
name = f"{time.time()}.txt"
|
|
204
208
|
else:
|
|
205
209
|
logging.error(f'{self.message_skip_prefix}file must be a path (str) or file-like object, got {type(file).__name__}')
|
|
206
210
|
return None
|
|
@@ -237,7 +241,7 @@ class TGHandler(logging.Handler):
|
|
|
237
241
|
next_flush = math.ceil(cur_time / self.flush_interval) * self.flush_interval
|
|
238
242
|
sleep_time = next_flush - cur_time
|
|
239
243
|
if sleep_time > 0:
|
|
240
|
-
|
|
244
|
+
self.shutdown_event.wait(timeout=sleep_time)
|
|
241
245
|
|
|
242
246
|
log_entries = []
|
|
243
247
|
while True: # drain queue
|
|
@@ -432,8 +436,9 @@ def setup(level=logging.DEBUG, capture_warnings=True, exception_hook=True, use_t
|
|
|
432
436
|
|
|
433
437
|
logging.info('*******')
|
|
434
438
|
|
|
435
|
-
def tg_send_file(file, name, caption='', is_error=False):
|
|
436
|
-
TG_HANDLER.send_file(file, name, caption, is_error)
|
|
439
|
+
def tg_send_file(file, name=None, caption='', is_error=False):
|
|
440
|
+
t = threading.Thread(target=TG_HANDLER.send_file, args=(file, name, caption, is_error), daemon=False)
|
|
441
|
+
t.start()
|
|
437
442
|
|
|
438
443
|
TG_HANDLER = TGHandler()
|
|
439
444
|
CW_HANDLER = CWHandler()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dvlogger
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.7
|
|
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.
|
|
7
|
+
version = "2.0.7"
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|