[Bug 41199] [patch] Enhance logging system

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Oct 4 21:17:02 CEST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=41199

--- Comment #11 from Daniele E. Domenichelli <daniele.domenichelli at gmail.com> 2011-10-04 12:17:01 PDT ---
New version pushed (always here [1])


(In reply to comment #10)
> THOUGH: please verify it doesn't
> put "" around the original string as I think it might do. That would be ugly.
[...]
> One thing in its implementation too:
> 
> qDebug() << qPrintable(libraryName) << qPrintable(libraryVersion) << "DEBUG:"
> << msg;
> 
> the library name and version are in the ASCII subset anyway. qPrintable will be
> a needless memory allocation and conversion, having no effect on the output. Or
> does that somehow get rid of the QDebug behavior of putting "" around printed
> QStrings? You can get rid of that by not making QStrings out of them in the
> first place (also needless memory alloc and copy), but just using preprocessor
> string concatenation like the old code did, as that yields a C string literal,
> not a QString.

Yes, that's the only way that I found to get rid of the "" around the QStrings,
if you have any other suggestions on how to do it I'll be happy to change it
because it looks ugly to me too...
The previous version used to print inside "" just the debug message, but I got
rid of that in the same way:

qDebug() << qPrintable(libraryName) << qPrintable(libraryVersion) << "DEBUG:"
<< qPrintable(msg);


> With these refactors, please verify the library still compiles and works fine
> even if debugging is disabled at compile time (ENABLE_DEBUG_OUTPUT cmake
> variable). And when it's enabled at compile time, that both runtime enable and
> disable work, with the former producing sensible debug output with no
> formatting issues like stray " characters.
> 
> You can verify the runtime debug disable behavior by adjusting
> Test::initTestCaseImpl() in tests/lib/test.cpp, and running make check.


Verified ENABLE_DEBUG_OUTPUT=OFF and tested that both runtime enable and
disable work, but tbh I couldn't do it with the tests because I cannot enable
the normal output... Anyway I tested it with kde-telepathy file transfer
handler enabling and disabling debug and warnings with Tp::enableDebug() and
Tp::enableWarnings(), and setting/unsetting the callback with
Tp::setDebugCallback and it behaves exactly as expected.


[1]https://gitorious.org/drdanz-telepathy-kde/telepathy-qt4/commits/logging_enhancement

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the telepathy-bugs mailing list