diff --git a/src/util/logging.cpp b/src/util/logging.cpp index 93385eb8617..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}"); @@ -40,7 +50,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}" @@ -334,12 +344,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.