fix error
Some checks failed
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 39s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 39s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 51s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 41s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 1m52s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 49s

This commit is contained in:
tqcq 2024-12-11 17:42:19 +08:00
parent c06ae29c2f
commit e1d529e847

View File

@ -142,14 +142,14 @@ SetLogLevel(LogLevel level)
void void
SetLogFileName(const char *file_name) SetLogFileName(const char *file_name)
{ {
std::ofstream tmp_stream(file_name, std::ios_base::app);
if (tmp_stream.is_open()) { if (tmp_stream.is_open()) {
Waiter waiter(g_request_id.fetch_add(1), g_current_id); Waiter waiter(g_request_id.fetch_add(1), g_current_id);
waiter.wait(); waiter.wait();
g_log_stream.close(); g_log_stream.close();
g_log_file_name = file_name; g_log_file_name = file_name;
std::ofstream tmp_stream(file_name, std::ios_base::app); g_log_stream = std::ofstream(file_name, std::ios_base::app);
g_log_stream = tmp_stream;
} else { } else {
LOGE("log", "can't open new log file [{}]", file_name); LOGE("log", "can't open new log file [{}]", file_name);
return; return;