fix(date): file log add date, month start with 1
Some checks failed
android / build (push) Failing after 24s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Failing after 6m29s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Failing after 8m26s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Failing after 6m49s
linux-arm-gcc / linux-gcc-arm (Release) (push) Failing after 7m23s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Failing after 6m55s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Failing after 7m30s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Failing after 7m39s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Failing after 7m58s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 7m53s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 7m53s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Failing after 8m26s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Failing after 7m14s
android / build (pull_request) Failing after 17s
linux-x64-clang / linux-clang (Debug) (push) Failing after 32s
linux-x64-clang / linux-clang (Release) (push) Failing after 30s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (pull_request) Failing after 6m37s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (pull_request) Failing after 7m38s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 9m54s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 3h2m32s
linux-arm-gcc / linux-gcc-arm (Debug) (pull_request) Failing after 6m59s
linux-arm-gcc / linux-gcc-arm (Release) (pull_request) Failing after 7m21s
linux-arm-gcc / linux-gcc-armhf (Debug) (pull_request) Failing after 7m0s
linux-arm-gcc / linux-gcc-armhf (Release) (pull_request) Failing after 7m30s
linux-x86-gcc / linux-gcc (Debug) (push) Failing after 10m11s
linux-mips-gcc / linux-gcc-mipsel (Debug) (pull_request) Failing after 8m12s
linux-x86-gcc / linux-gcc (Release) (push) Failing after 3h13m27s
linux-mips-gcc / linux-gcc-mipsel (Release) (pull_request) Failing after 8m24s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (pull_request) Failing after 7m50s
linux-mips64-gcc / linux-gcc-mips64el (Release) (pull_request) Failing after 7m54s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (pull_request) Failing after 8m27s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (pull_request) Failing after 7m15s
linux-x64-clang / linux-clang (Debug) (pull_request) Failing after 1m38s
linux-x64-clang / linux-clang (Release) (pull_request) Failing after 54s
linux-x64-gcc / linux-gcc (Debug) (pull_request) Failing after 10m8s
linux-x64-gcc / linux-gcc (Release) (pull_request) Failing after 2h57m16s
linux-x86-gcc / linux-gcc (Debug) (pull_request) Failing after 10m35s
linux-x86-gcc / linux-gcc (Release) (pull_request) Failing after 3h10m34s

This commit is contained in:
tqcq 2024-10-07 17:40:29 +08:00
parent 7c4395e897
commit f5d3fcdf63
2 changed files with 3 additions and 1 deletions

View File

@ -389,7 +389,7 @@ LogSink::ToString(LogSeverity severity,
{
std::stringstream ss;
char date_time[64];
sprintf(date_time, "%4d-%02d-%02dT%02d:%02d:%02d.%06d", logmsgtime.year() + 1900, logmsgtime.month(),
sprintf(date_time, "%4d-%02d-%02dT%02d:%02d:%02d.%06d", logmsgtime.year() + 1900, logmsgtime.month() + 1,
logmsgtime.day(), logmsgtime.hour(), logmsgtime.min(), logmsgtime.sec(), logmsgtime.usec());
ss << date_time;

View File

@ -23,6 +23,8 @@ BasicFileSink::Send(LogSeverity severity,
size_t message_len)
{
TILE_CHECK(!filepath_.empty(), "filepath is empty");
auto msg = ToString(severity, full_filename, base_filename, line, logmsgtime, message, message_len);
while (!msg.empty() && msg.back() != '\n') { msg.push_back('\n'); }
ofs_ << std::string(message, message_len) << std::endl;
}