diff --git a/src/log/AbstractStringAppender.cpp b/src/log/AbstractStringAppender.cpp index 78ae2199..8cf35185 100644 --- a/src/log/AbstractStringAppender.cpp +++ b/src/log/AbstractStringAppender.cpp @@ -339,6 +339,11 @@ QString AbstractStringAppender::formattedString(const QDateTime &time, Logger::L bool withcolor) const { QString f = format(); + + // dtkcore无法正确解析Qt的日志格式,dtk默认的日志格式并未和Qt统一,解析方式需要兼容两种不同的格式。 + if (f.contains(QLatin1String("time "))) + f.replace(f.indexOf(' ', f.indexOf(QLatin1String("time")) + QLatin1String("time").size()), 1, QLatin1String("}{")); + const int size = f.size(); QString result; diff --git a/src/log/ConsoleAppender.cpp b/src/log/ConsoleAppender.cpp index c89a9c43..6969b5b7 100644 --- a/src/log/ConsoleAppender.cpp +++ b/src/log/ConsoleAppender.cpp @@ -38,7 +38,7 @@ DCORE_BEGIN_NAMESPACE ConsoleAppender::ConsoleAppender() : AbstractStringAppender() - ,m_ignoreEnvPattern(false) + , m_ignoreEnvPattern(false) { if (!spdlog::get("console")) { auto clogger = spdlog::stdout_color_mt("console");