debug log - small but substantial change for 3.0.0 and fancy output
mark at kingant.net
Mon Aug 19 03:20:38 EDT 2013
On Thu, Aug 15, 2013 at 9:50 AM, Jorge Villaseñor <salinasv at gmail.com> wrote:
> On Wed, Aug 14, 2013 at 8:40 AM, Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
>> Currently, all calls to purple_debug_* should be terminated with LF
>> character. This can be handy in one awful situation: when we want to
>> print out the debug message in multiple calls to purple_debug_info. I
>> suggest changing this behavior: messages could be passed in their bare
>> form and LF (or other formatting data) could be added by logger
>> Advantages: I won't forget about trailing \n anymore; debug loggers
>> (like for our gtk frontend) will get debug messages clearly separated.
> I am not sure if this could break some use cases. And if it does, we should
> provide a way to service that use cases.
I think there probably are a very small number of places in our code
that benefit from not having an automatic newline. I looked in the
oscar prpl and found exactly one example, the dumptlv function in
family_locate.c. But that function hasn't been used in many years.
Anyway, I'm mildly in favor of this change. Can you also update the
doc comments for the purple_debug functions to mention that it's not
necessary to include a trailing newline in debug messages and that
trailing newlines and other whitespace will be stripped from the
>> Another change is strictly about console output: there could be
>> additional switch "--debug=colored" to enable colors in bash console.
>> I've prepared an implementation for it. Cool, isn't it?
> Does this formating works on non-bash consoles? I am not sure ksh, csh, zsh
> ... share the same formating.
I'm in favor of colored output as an option that defaults to false.
Thanks! If people like it and it works well in all terminals, we could
consider making it the default down the road.
> And a cosmetic note. I would rather change that if-else-if-else with a
> switch-case statement. =)
That's funny, I personally have a slight preference for
if-else-if-else. It's a little more verbose, but it avoids the danger
of accidentally omitting a 'break'. I also find it hard to indent
switch-case in a way that looks nice and isn't doubly-indented.
Another random style comment... I personally have a slight preference for this:
instead of this:
gboolean debug_enabled, debug_colored;
because I think it makes diffs easier to read, makes merges cleaner,
and I find it slightly easier to read.
More information about the Devel