Re: [AD] configurable logging

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2009-03-26, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> Milan Mimica wrote:
> > Elias Pschernig wrote:
> >> And finally whether to prepend log messages with file:linenumber, just 
> >> because I like to find things faster - but off by default.
> > 
> > I especially like this. Adding a function name would make it even more easy to read.
> 
> With gcc, very easy to do as it has __FUNCTION__. C99 only defines 
> __FILE__ and __LINE__ though, so I suspect MSVC won't have __FUNCTION__.

In almsvc.h:

    /* __func__ is C99 */
    #ifndef __func__
       /* MSVC versions before VC7 don't have __FUNCTION__ */
       #if _MSVC_VER < 1300
	  #define __func__ "???"
       #else
	  #define __func__ __FUNCTION__
       #endif
    #endif

> >> The use inside the source code would not change much from how it is 
> >> currently, except the somewhat cumbersome PREFIX_* definitions would not 
> >> exist any longer. At the beginning of each source file, we would instead 
> >> have something like:
> > 
> > Do you have an implementation already?
> > 
> 
> I have some proof-of-concept code inspired by Wine, yes. The hard part 
> will be changing all TRACE(PREFIX_W to ALLEGRO_WARN and filling in the 
> debug channels though.

I think it's a fine idea.  Sounds like log4j, etc.

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/