From c0d249019b098890fb8e5e9e144c2dd8029a670c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 13 Apr 2012 13:37:56 +0200 Subject: Allow qDebug output to be configured by qSetMessagePattern() Add qSetMessagePattern() to configure the default message pattern. This one can still be overwritten by setting the QT_MESSAGE_PATTERN environment variable. Without this method, there's actually no way to change the default output programatically. Since QT_MESSAGE_PATTERN is evaluated when the first message arrives, setting it via e.g. qputenv might have no effect/be too late. Change-Id: I115e0c30606f128fdbf5c169a951ffa2a6a48517 Reviewed-by: Thiago Macieira --- tests/auto/corelib/global/qlogging/app/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto/corelib/global/qlogging/app') diff --git a/tests/auto/corelib/global/qlogging/app/main.cpp b/tests/auto/corelib/global/qlogging/app/main.cpp index dfa52315c7..2f5a975e43 100644 --- a/tests/auto/corelib/global/qlogging/app/main.cpp +++ b/tests/auto/corelib/global/qlogging/app/main.cpp @@ -51,8 +51,15 @@ int main(int argc, char **argv) QCoreApplication app(argc, argv); app.setApplicationName("tst_qlogging"); + qSetMessagePattern("[%{type}] %{message}"); + qDebug("qDebug"); qWarning("qWarning"); qCritical("qCritical"); + + qSetMessagePattern(QString()); + + qDebug("qDebug2"); + return 0; } -- cgit v1.2.3