summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-04-27 15:59:32 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-04-27 16:02:29 +0900
commitfe423b35a83c82acae185a122652cc221debe8d2 (patch)
tree181a868de9c1f0900b14041c476bc1d8d3d79427
parent882c28f2765e617ad7fdad0362cbdf7536ac7f96 (diff)
downloadtdelibs-fe423b35a83c82acae185a122652cc221debe8d2.tar.gz
tdelibs-fe423b35a83c82acae185a122652cc221debe8d2.zip
Added timestamp to debug backend (kdDebug, kdWarning, ...).
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 0e7f9b8db10ef4c4fbc414bf2c6d804265c54ca4)
-rw-r--r--tdecore/kdebug.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tdecore/kdebug.cpp b/tdecore/kdebug.cpp
index 73094ecd5..d906f67fc 100644
--- a/tdecore/kdebug.cpp
+++ b/tdecore/kdebug.cpp
@@ -294,13 +294,15 @@ static void kDebugBackend( unsigned short nLevel, unsigned int nArea, const char
const int BUFSIZE = 4096;
char buf[BUFSIZE];
if ( !kDebug_data->aAreaName.isEmpty() ) {
- strlcpy( buf, kDebug_data->aAreaName.data(), BUFSIZE );
- strlcat( buf, ": ", BUFSIZE );
+ strlcpy( buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] [").ascii(), BUFSIZE );
+ strlcat( buf, kDebug_data->aAreaName.data(), BUFSIZE );
+ strlcat( buf, "] ", BUFSIZE );
+ strlcat( buf, data, BUFSIZE );
+ }
+ else {
+ strlcpy( buf, TQDateTime::currentDateTime().toString("[yyyy/MM/dd hh:mm:ss.zzz] ").ascii(), BUFSIZE );
strlcat( buf, data, BUFSIZE );
}
- else
- strlcpy( buf, data, BUFSIZE );
-
// Output
switch( nOutput )