Spaces:
Sleeping
Sleeping
Rename telegramhandler.py to classes.py
Browse files
telegramhandler.py β classes.py
RENAMED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
class CustHand(logging.Handler):
|
2 |
def __init__(self, client, chat_id):
|
3 |
super().__init__()
|
@@ -6,4 +8,15 @@ class CustHand(logging.Handler):
|
|
6 |
|
7 |
async def emit(self, record):
|
8 |
log_entry = self.format(record)
|
9 |
-
await self.client.send_message(chat_id=self.chat_id, text=log_entry)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from aiologger.handlers.files import AsyncFileHandler
|
2 |
+
|
3 |
class CustHand(logging.Handler):
|
4 |
def __init__(self, client, chat_id):
|
5 |
super().__init__()
|
|
|
8 |
|
9 |
async def emit(self, record):
|
10 |
log_entry = self.format(record)
|
11 |
+
await self.client.send_message(chat_id=self.chat_id, text=log_entry)
|
12 |
+
|
13 |
+
|
14 |
+
class CustHand2(AsyncFileHandler):
|
15 |
+
def __init__(self, client, chat_id, *args, **kwargs):
|
16 |
+
super().__init__(*args, **kwargs)
|
17 |
+
self.client = client
|
18 |
+
self.chat_id = chat_id
|
19 |
+
|
20 |
+
async def emit(self, record):
|
21 |
+
log_entry = self.format(record)
|
22 |
+
await self.client.send_message(chat_id=self.chat_id, text=log_entry
|