mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
修改减少modbus报警信息,以及websocket报警信息
This commit is contained in:
@@ -421,7 +421,8 @@ class MessageProcessor:
|
|||||||
ssl_context = ssl_module.create_default_context()
|
ssl_context = ssl_module.create_default_context()
|
||||||
|
|
||||||
ws_logger = logging.getLogger("websockets.client")
|
ws_logger = logging.getLogger("websockets.client")
|
||||||
ws_logger.setLevel(logging.INFO)
|
# ws_logger.setLevel(logging.INFO)
|
||||||
|
ws_logger.setLevel(logging.WARNING) # 只显示警告和错误
|
||||||
|
|
||||||
async with websockets.connect(
|
async with websockets.connect(
|
||||||
self.websocket_url,
|
self.websocket_url,
|
||||||
|
|||||||
@@ -192,6 +192,13 @@ def configure_logger(loglevel=None):
|
|||||||
# 添加处理器到根日志记录器
|
# 添加处理器到根日志记录器
|
||||||
root_logger.addHandler(console_handler)
|
root_logger.addHandler(console_handler)
|
||||||
|
|
||||||
|
# 降低第三方库的日志级别,避免过多输出
|
||||||
|
# pymodbus 库的日志太详细,设置为 WARNING
|
||||||
|
logging.getLogger('pymodbus').setLevel(TRACE_LEVEL)
|
||||||
|
logging.getLogger('pymodbus.logging').setLevel(TRACE_LEVEL)
|
||||||
|
logging.getLogger('pymodbus.logging.base').setLevel(TRACE_LEVEL)
|
||||||
|
logging.getLogger('pymodbus.logging.decoders').setLevel(TRACE_LEVEL)
|
||||||
|
|
||||||
|
|
||||||
# 配置日志系统
|
# 配置日志系统
|
||||||
configure_logger()
|
configure_logger()
|
||||||
|
|||||||
Reference in New Issue
Block a user