Re: [Evolution-hackers] [Evolution] Debug enhancements for evo



On Wed, 2007-09-05 at 16:05 -0400, Matthew Barnes wrote:
> On Wed, 2007-09-05 at 15:03 -0400, Paul Smith wrote:
> > It seems that Evo is using a standard library (glib maybe?) to provide
> > debug/logging facilities.  Is there any way to either resolve these
> > issues in Evo itself, or else get them resolved by whomever manages the
> > libraries?
> 
> I don't have an answer to your immediate question but I have thought
> about Evolution's debug/logging facilities a bit.
> 
> A lot of good debugging information is disabled in the released tarballs
> using this technique:
> 
>    #define d(x)
> 
>    ...
> 
>    d(printf ("Useful debugging info..."));
> 
> A developer or interested hacker then has to redefine "d" as
> 
>    #define d(x) x
> 
> and recompile to unlock those debug messages.
> 
> The problem with this is there's no central logging mechanism that all
> the messages flow through, so adding a timestamp as you suggested (and
> an excellent suggestion it is) would require changing all the messages
> individually.
> 
> Instead, we should better utilize GLib's logging features.  For
> starters, change all debug messages over to
> 
>    g_debug ("Useful debugging info...");
> 
> and give each Makefile.am a unique G_LOG_DOMAIN.
> 
> Then register a handler function for all DEBUG-level messages.
> Depending on whether a DEBUG message's log domain is turned on or off
> (off by default), the handler function could time-stamp and print the
> message or silently eat it, respectively.
> 
> Log domains could be turned on perhaps by way of an environment variable
> (and/or make the --debug option actually do something useful):
> 
>    EVO_DEBUG=colon:separated:list:of:logging:domains
> 
> There's a lot we could do here.  These are just a few ideas.  Something
> to shoot for in Evolution 2.14, perhaps?
> 
> Further discussion should be moved to evolution-hackers.

Hereby moved. Maybe something like what I do in e-b could be used or
maybe inspire evo debugging...

I've had many of the same problems that Paul describes. One of the most
annoying ones was that I had to start evolution and e-d-s in separate
terminals to get debugging output from both. 

My solution was to write a small log daemon and then use a combination
of macros and utility functions to write to the log daemon.

The result can be seen if you download this tarball:

http://www.omesc.com/sites/default/files/downloads/dist/evolution-brutus/SOURCES/evolution-brutus-1.1.29.8.tar.gz

and inspect the log sub-directory as well as 'server/brutus.h' and
'server/brutus_debug.c'. All logging happens conditionally depending on
whether the BRUTUS_DEBUG environment variable is defined and whether or
not debugging has been enabled at compile time. Timestamps are on or off
depending on yet another environment variable.

HTH,
  jules





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]