[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    KDE/kdelibs/kdecore/io
From:       David Faure <faure () kde ! org>
Date:       2008-09-26 19:30:23
Message-ID: 1222457423.512214.14798.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 865126 by dfaure:

I like the kDebug header when running apps or looking at .xsession-errors.
But when working on a unit test, getting all this for kDebug()<<"foo" is a bit too \
much redundancy: QDEBUG : KDirListerTest::testConcurrentHoldingListing() \
                qttest(16022)/kio (KDirListerCache) KDirListerCache::printDebug: foo
-> introducing $KDE_DEBUG_NOPROCESSINFO, $KDE_DEBUG_NOAREANAME and \
$KDE_DEBUG_NOMETHODNAME environment variables. I think the first one should even be \
set in qtest_kde.h; the qttest(16022) part is not useful for unittests IMHO.

CCMAIL: kde-core-devel@kde.org


 M  +19 -9     kdebug.cpp  


--- trunk/KDE/kdelibs/kdecore/io/kdebug.cpp #865125:865126
@@ -440,14 +440,24 @@
     QDebug printHeader(QDebug s, const QByteArray &areaName, const char *, int, \
const char *funcinfo, bool colored)  {
 #ifdef KDE_EXTENDED_DEBUG_OUTPUT
-        QByteArray programName = cache.value(0).name;
-        if (programName.isEmpty())
-            programName = "<unknown program name>";
-        s.nospace() << programName.constData() << "(" << unsigned(getpid()) << ")";
-        if (areaName != programName)
-            s << "/" << areaName.constData();
+        static bool printProcessInfo = \
(qgetenv("KDE_DEBUG_NOPROCESSINFO").isEmpty()); +        static bool printAreaName = \
(qgetenv("KDE_DEBUG_NOAREANAME").isEmpty()); +        static bool printMethodName = \
(qgetenv("KDE_DEBUG_NOMETHODNAME").isEmpty()); +        QByteArray programName;
+        s = s.nospace();
+        if (printProcessInfo) {
+            programName = cache.value(0).name;
+            if (programName.isEmpty())
+                programName = "<unknown program name>";
+            s << programName.constData() << "(" << unsigned(getpid()) << ")";
+        }
+        if (printAreaName && (!printProcessInfo || areaName != programName)) {
+            if (printProcessInfo)
+                s << "/";
+            s << areaName.constData();
+        }
 
-        if (funcinfo) {
+        if (funcinfo && printMethodName) {
             if(colored)
                 s << "\033[0;34m"; //blue
 # ifdef Q_CC_GNU
@@ -517,7 +527,7 @@
 
         if (areaName.isEmpty())
             areaName = cache.value(0).name;
-        
+
         bool colored=false;
 
         QDebug s(&devnull);
@@ -539,7 +549,7 @@
             s = setupQtWriter(type);
 #ifndef Q_OS_WIN
             //only color if the debug goes to a tty.
-            colored = env_colored && isatty(fileno(stderr));  
+            colored = env_colored && isatty(fileno(stderr));
 #endif
             break;
         }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic