From de1179837abc506fc63881207ce562f4c179ae9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 4 Jan 2021 11:54:39 +0100 Subject: [PATCH 1/3] remove not working %{function} tag in the debug message. It is always unknown. --- src/util/logging.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/logging.cpp b/src/util/logging.cpp index 93385eb8617..0432a9614c3 100644 --- a/src/util/logging.cpp +++ b/src/util/logging.cpp @@ -40,7 +40,7 @@ const QString kDefaultMessagePattern = QStringLiteral("%{type} [") + const QString kDefaultMessagePatternColor = QStringLiteral( "%{if-category}\033[35m %{category}:\033[35m%{endif}" - "%{if-debug}\033[34m%{type} \033[36m%{function}%{endif}" + "%{if-debug}\033[34m%{type}%{endif}" "%{if-info}\033[32m%{type}%{endif}" "%{if-warning}\033[93m%{type}%{endif}" "%{if-critical}\033[91m%{type}%{endif}" From fb351d7603e8e65771957d504eae1e30290df6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 4 Jan 2021 12:22:51 +0100 Subject: [PATCH 2/3] Remove redundant environment variable check. QT does this already. --- src/util/logging.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/util/logging.cpp b/src/util/logging.cpp index 0432a9614c3..1d8d554cb8c 100644 --- a/src/util/logging.cpp +++ b/src/util/logging.cpp @@ -334,12 +334,10 @@ void Logging::initialize( s_debugAssertBreak = debugAssertBreak; - if (qEnvironmentVariableIsEmpty("QT_MESSAGE_PATTERN")) { - if (CmdlineArgs::Instance().useColors()) { - qSetMessagePattern(kDefaultMessagePatternColor); - } else { - qSetMessagePattern(kDefaultMessagePattern); - } + if (CmdlineArgs::Instance().useColors()) { + qSetMessagePattern(kDefaultMessagePatternColor); + } else { + qSetMessagePattern(kDefaultMessagePattern); } // Install the Qt message handler. From b6bf7c2c4e41e10bd90db58aefd19d511f7b6254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 5 Jan 2021 08:39:08 +0100 Subject: [PATCH 3/3] added a comment gregarding QT_MESSAGE_PATTERN --- src/util/logging.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/logging.cpp b/src/util/logging.cpp index 1d8d554cb8c..34eb3c0611d 100644 --- a/src/util/logging.cpp +++ b/src/util/logging.cpp @@ -33,6 +33,16 @@ QFile s_logfile; // Whether to break on debug assertions. bool s_debugAssertBreak = false; +// Note: +// you can customize this pattern by starting Mixxx with +// QT_MESSAGE_PATTERN="%{message}" mixxx +// For debugging timing related issues +// QT_MESSAGE_PATTERN="%{time yyyyMMdd h:mm:ss.zzz} %{type} [{{threadname}}] %{message}" +// Or for for finding the origin (in Debug builds) +// QT_MESSAGE_PATTERN="%{type} [{{threadname}}] %{file}:%{line} %{message}" +// QT_MESSAGE_PATTERN="%{type} [{{threadname}}] %{function} %{message}" +// TODO: Adjust the default format and messages and collect file and function info in release builds as well. + const QString kThreadNamePattern = QStringLiteral("{{threadname}}"); const QString kDefaultMessagePattern = QStringLiteral("%{type} [") + kThreadNamePattern + QStringLiteral("] %{message}");