-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Fixed logging keeps outputting httpx.RemoteProtocolError: Server disconnected without sending a response. 2. Fixed the incorrect assignment of the Claude Max token. ⚙️ Dependence 1. Upgrade python telegram bot library to 21.0.1
- Loading branch information
Showing
9 changed files
with
89 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
|
||
class SpecificStringFilter(logging.Filter): | ||
def __init__(self, specific_string): | ||
super().__init__() | ||
self.specific_string = specific_string | ||
|
||
def filter(self, record): | ||
return self.specific_string not in record.getMessage() | ||
|
||
# 创建一个 logger | ||
logger = logging.getLogger('my_logger') | ||
logger.setLevel(logging.DEBUG) | ||
|
||
# 创建一个 console handler,并设置级别为 debug | ||
ch = logging.StreamHandler() | ||
# ch.setLevel(logging.DEBUG) | ||
|
||
# 创建一个 filter 实例 | ||
specific_string = "httpx.RemoteProtocolError: Server disconnected without sending a response." | ||
my_filter = SpecificStringFilter(specific_string) | ||
|
||
# 将 filter 添加到 handler | ||
ch.addFilter(my_filter) | ||
|
||
# 将 handler 添加到 logger | ||
logger.addHandler(ch) | ||
|
||
# 测试日志消息 | ||
logger.debug("This is a debug message.") | ||
logger.error("This message will be ignored: ignore me.httpx.RemoteProtocolError: Server disconnected without sending a response.") | ||
logger.info("Another info message.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters