[Development] (long) thoughts on categorized logging (qLog)
Lincoln Ramsay
lincoln.ramsay at nokia.com
Fri Feb 24 01:07:52 CET 2012
On 02/24/2012 02:32 AM, Koehne Kai (Nokia-MP/Berlin) wrote:
> It's probably the easiest to just default to have an empty string as 'legacy'
> category. This preserves the output of qDebug(), even if %{category} is printed by default
> as suggested below.
Disclaimer: I'm making up the format string identifiers (so they may not
match what's in there now).
The reason I hesitated with this is that (as far as I know) nothing else
in the format string can be empty. So a format string like
"%{file}:${line} %{func} %{message}" works.
foo.c:23 main() the message
However, a format string of say, "%{category}: %{file}:${line} %{func}
%{message}" would look odd when the category is empty.
mycat: foo.c:23 main() qCDebug
: foo.c:23 main() qDebug
I took the easy way of declaring a category for qDebug so I wouldn't
have to figure out how to do conditional formatting :)
But then if category strings end up long like "com.nokia.qt.plugins" it
might be a bit of a problem to print them out by default anyway. I guess
having the category printed is most useful in a "print out lots of
debugs then grep for one you want" case...
> Just wanted to point out that the current environment variable for configuring
> the output is called QT_MESSAGE_PATTERN. So it should be either QT_MESSAGE_CONFIG,
> or we should quickly rename QT_LOGGING_PATTERN ...
I guess QT_MESSAGE_CONFIG would be better.
--
Lincoln Ramsay - Senior Software Engineer
Qt Development Frameworks, Nokia - http://qt.nokia.com/
More information about the Development
mailing list