[Kde-pim] KDE/kdelibs/kdecore/io

Guy Maurel guy-kde at maurel.de
Thu Jun 3 15:40:46 BST 2010


Hello!

I would like to propose an extention to you work.

On Thursday 20 May 2010 17:30:58 David Faure wrote:

> If you export KDE_DEBUG_TIMESTAMP=1 then you'll get time information in front of every debug line.
you get the time as
17:03:24

If you want to get a little bit more, such as 
17:03:24.123

with the milliseconds, you export KDE_DEBUG_TIMESTAMP=2 and the extention below:
-- kdebug.cpp  (revision 1108955)
+++ kdebug.cpp  (working copy)
@@ -509,8 +509,22 @@
         static bool printProcessInfo = (qgetenv("KDE_DEBUG_NOPROCESSINFO").isEmpty());
         static bool printAreaName = (qgetenv("KDE_DEBUG_NOAREANAME").isEmpty());
         static bool printMethodName = (qgetenv("KDE_DEBUG_NOMETHODNAME").isEmpty());
+        static bool printTimeStamp = !(qgetenv("KDE_DEBUG_TIMESTAMP").isEmpty());
         QByteArray programName;
         s = s.nospace();
+        if (printTimeStamp) {
+            // get the value
+            QByteArray KdeDebugTimeStamp = qgetenv("KDE_DEBUG_TIMESTAMP");
+            if (KdeDebugTimeStamp == "2") {
+                // the extended print: 17:03:24.123
+                QString sformat = QString::fromAscii( "hh:mm:ss.zzz");
+                s << qPrintable(QDateTime::currentDateTime().time().toString( sformat));
+            } else {
+                // the default print: 17:03:24
+                s << qPrintable(QDateTime::currentDateTime().time().toString());
+            }
+            s << ' ';
+        }
         if (printProcessInfo) {
             programName = cache.value(0).name;
             if (programName.isEmpty()) {

-- 
guy
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list