diag/debug prints library

  I'm thinking that this question is probably better suited for 
a GNU devel list instead of GNOME-devel, but I'm regularly reminded
of this problem when using some GTK+ and GNOME apps that send a lot 
of debug information to stdout and stderr even when compiled non-debug. 
Usually thru assert() it seems. 

  Is there a GNU/GPL'd library available the provides macros for
sending debug and diag. messages to stdout and stderr with 
conditional compilation depending on a #define for debug level:

#define _DEBUG_LEVEL_ 3

  For most of my code for Uni. I normally setup a dbgtools.h which 
has just these kind of macros. For example:

DIAG_PRINT("The SEQ number %d is outside the current window.\n", seq_num);


DEBUG_PRINT(dbg_level, "%s is invalid!\n", foo_str);

  This way I determine just how much debugging/diag. info. I want sent 
to stdout and stderr at compile time yet I don't get all the overhead 
from the print statements when I am ready to call the code "release".
and remove the -D_DEBUG_ -D_DIAGS_ from my Makefile. You have a little 
control over what does/does not go to the console with assert(), but 
fprintf(stderr,...) doesn't have any granularity at all. 

  Anyway...does such a beast exist? Would anyone be interested in
using and/or helping develop a library to do such things? I'm 
thinking of writing at least a quick hack with this functionality
over the holiday break from Uni. I don't want to reimplement 
functionality that may already exist in some other package tho so
that's why I'm asking.


Nathan Valentine - nrvale0@pop.uky.edu 		AIM: NRVesKY
University of Kentucky Linux Users Group

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