Re: [AD] TRACEs in xkeyboard.c

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


On Fri, 2005-09-23 at 21:14 +0200, Grzegorz Adam Hankiewicz wrote:
> On 2005-09-22, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> > But since all other parts of Allegro have almost no runtime
> > information at all, and we have no way to have different debug
> > classes and levels (something we should add after 4.2), and user
> > code also might use TRACE and allegro.log, I wonder if those
> > TRACE calls should be removed for 4.2.0..
> 
> More should be added to the rest of the code. Information on error
> return paths during a call to set_gfx_mode(GFX_AUTODETECT,...) would
> be very handy to understand why a user has compiled support for
> three drivers yet none of them works and allegro_error stores only
> the last message, which tends to be useless.
> 
> The same could be applied to all Windows sound drivers to find
> out about Win98 sound problems/hangs and why DIGI_AUTODETECT isn't
> good enough.
> 
> Yes, TRACE doesn't support levels or "classes", but it would be
> as easy as prefixing all internal TRACEs with "alleg: " so you can
> grep it out from the log if a developer is using it too for himself.
> 

Yes, attached patch does that. It uses a per-file #define to set the
prefix, and now simply xkeyboard.c uses an "alleg-keyboard" prefix.

-- 
Elias Pschernig
Index: include/allegro/debug.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/debug.h,v
retrieving revision 1.3
diff -u -p -r1.3 debug.h
--- include/allegro/debug.h	7 Mar 2005 22:55:21 -0000	1.3
+++ include/allegro/debug.h	24 Sep 2005 11:09:59 -0000
@@ -34,7 +34,8 @@ AL_FUNC(void, register_trace_handler, (A
 
 #ifdef DEBUGMODE
    #define ASSERT(condition)     { if (!(condition)) al_assert(__FILE__, __LINE__); }
-   #define TRACE                 al_trace
+   #define                       TRACE_PREFIX
+   #define TRACE                 TRACE_PREFIX al_trace
 #else
    #define ASSERT(condition)
    #define TRACE                 1 ? (void) 0 : al_trace
Index: src/x/xkeyboard.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xkeyboard.c,v
retrieving revision 1.14
diff -u -p -r1.14 xkeyboard.c
--- src/x/xkeyboard.c	3 Sep 2005 14:05:08 -0000	1.14
+++ src/x/xkeyboard.c	24 Sep 2005 11:09:59 -0000
@@ -30,7 +30,8 @@
 #include "allegro/internal/aintern.h"
 #include "xwin.h"
 
-// TODO: Once this driver is deemed more stable, reduce debugging output.
+#undef TRACE_PREFIX
+#define TRACE_PREFIX al_trace("alleg-xkeyboard: ");
 
 #ifdef ALLEGRO_USE_XIM
 static XIM xim = NULL;


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