Fix: Client log dialog stops updating past edit-control default limit
The Win32 EDIT control caps text at ~32K/64K chars by default, so the client log dialog silently stopped accepting appends long before the 512KB truncation logic could run. Call SetLimitText(0) in both CClientLog and CActivityDialog to lift the cap. Also unify newline handling in Logger: each entry now ends with exactly one '\n' at the source, so the in-memory ring-buffer dump (used by the TCP log query) splits into lines correctly instead of relying on every Mprintf caller ending its format with '\n'. writeToFile drops the extra std::endl accordingly. Additionally fix a CFont leak in CClientLog::OnInitDialog by moving the font to a member. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -152,6 +152,12 @@ public:
|
||||
id + "[" + timestamp + "] [" + file + ":" + std::to_string(line) + "] " + message:
|
||||
id + "[" + timestamp + "] " + message;
|
||||
|
||||
// 方案B:在源头统一保证每条日志以单个 '\n' 结尾,文件与内存 ring buffer
|
||||
// 共用同一份文本;写文件时不再额外追加换行,内存导出直接拼接即可正确分行。
|
||||
while (!logEntry.empty() && (logEntry.back() == '\n' || logEntry.back() == '\r'))
|
||||
logEntry.pop_back();
|
||||
logEntry += '\n';
|
||||
|
||||
// Always record to in-memory ring buffer regardless of enable flag.
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_memMutex);
|
||||
@@ -305,7 +311,7 @@ private:
|
||||
std::lock_guard<std::mutex> lock(fileMutex);
|
||||
std::ofstream logFile(logFileName, std::ios::app);
|
||||
if (logFile.is_open()) {
|
||||
logFile << logEntry << std::endl;
|
||||
logFile << logEntry; // logEntry 已在 log() 中以单个 '\n' 结尾
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user