增加了日志功能,修复了bug
This commit is contained in:
@@ -51,6 +51,12 @@ public:
|
||||
// 监控日志文件变化并推送新内容
|
||||
void monitorLogFile();
|
||||
|
||||
// 处理日志请求
|
||||
void handleLogRequest(struct mg_connection* c, const std::string& msg);
|
||||
|
||||
// 读取日志文件
|
||||
std::vector<std::string> readLogFile(int page, int pageSize, const std::string& level, const std::string& search);
|
||||
|
||||
private:
|
||||
// WebSocket事件处理函数
|
||||
void handleWebSocketEvent(struct mg_connection* c, int ev, void* ev_data, void* fn_data);
|
||||
@@ -72,12 +78,6 @@ private:
|
||||
std::vector<mg_connection*> ws_connections_; // WebSocket连接列表
|
||||
std::unordered_map<mg_connection*, uint64_t> ws_last_io_time_; // 连接最后活动时间
|
||||
|
||||
// 读取日志文件
|
||||
std::vector<std::string> readLogFile(int page, int pageSize, const std::string& level, const std::string& search);
|
||||
|
||||
// 处理WebSocket消息
|
||||
void handleWebSocketMessage(struct mg_connection* c, const std::string& msg);
|
||||
|
||||
// 日志文件相关
|
||||
std::string m_logFilePath = "pPowerManger.log";
|
||||
std::ifstream m_logFile;
|
||||
@@ -87,4 +87,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // HTTP_SERVER_H
|
||||
#endif // HTTP_SERVER_H
|
||||
|
||||
Reference in New Issue
Block a user