LogSink.dbg() vs no registered log handlers
From: Pascal Bourque <pascal@xxxxxxxxxxxxx>
Date: Tue, 13 Oct 2009 21:29:34 +0200 (CEST)
Hello,

In profiling the performance of our XMPP client, we found out that time spent in Tag::xml() was significant. The call stack revealed that it is ClientBase::handleTag() that calls it when it logs the incoming tag to the log sink:

  logInstance().dbg( LogAreaXmlIncoming, tag->xml() );

We were profiling the release build of our app, which doesn't register any log handlers to the LogSink. However, even though there are no log handlers, the call to dbg() will still execute, so is the call to tag- >xml() that is passed as a parameter to dbg(). This is a bit of a waste, as dbg() won't do anything with that text when there are no registered log handlers.

Would it be possible to add conditional preprocessor symbols to the gloox build system so we could completely exclude (#ifdef) the log methods for the log levels we don't care about?

I'd be happy to do it and submit a patch, but would like to hear others' feedback before I do...

Thanks,

Pascal