From aeec5ebd9259d1b79728a69f50e96347c3e933c2 Mon Sep 17 00:00:00 2001 From: tqcq Date: Mon, 11 Dec 2023 15:18:55 +0800 Subject: [PATCH] feature update log --- src/ulib/log/logger.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ulib/log/logger.cpp b/src/ulib/log/logger.cpp index 542fd93..3c3fc13 100644 --- a/src/ulib/log/logger.cpp +++ b/src/ulib/log/logger.cpp @@ -3,7 +3,8 @@ // #include "logger.h" -#include "fmt/format.h" +#include +#include #include #include #include @@ -26,16 +27,16 @@ Logger::Log(int32_t level, const char *file, const char *func, int32_t line, con { const char *level_name = Level::ToString(level); /** - * @brief level_name, file:line@func tag msg + * @brief time file:line@func tag level_name msg */ - std::string pattern = "[{:<5}] {} {}:{}@{} {}"; + std::string pattern = "{} {}:{}@{} {} [{:<5}]: {}"; // auto add CR bool need_append_line_break = !msg || *msg == '\0' || msg[strlen(msg) - 1] != '\n'; if (need_append_line_break) { pattern.append(1, '\n'); } - fmt::print(pattern, level_name, tag, file + stripped_prefix_len_, line, func, msg); + fmt::print(pattern, "", file + stripped_prefix_len_, line, func, tag, level_name, msg); } void