All~

My work has a really useful macro trace that expands as followed

#define trace(name_str, format_str, ...);  \
{ \
static bool traceMe = DO_WE_TRACE_THIS(name_str); \
if(traceMe) { \
DO_THE_TRACING(name_str, format_str, __VA_ARGS__); \
} \
}

Where DO_WE_TRACE_THIS can use whatever heirachical naming
convenctions one wants and DO_THE_TRACING can be anything from printf
to kernel logging depending on what one wants.

We actually leave these in the release versions of our product, but
one could easily filter them out with a different macro.  I know that
it doesn't allow you to change dynamically, but it does provide a fair
amount of speed for the not tracing case, as the condition is only
checked once.

Matt

On Mon, 1 Nov 2004 10:30:23 -0600, Timm Murray
<[EMAIL PROTECTED]> wrote:
> On Monday 01 November 2004 10:17 am, Sam Ruby wrote:
> > Dan Sugalski wrote:
> > > I'm considering adding in some new ops and a command-line switch to help
> > > debug parrot code, but before I did I figured I'd better throw it out to
> > > the list for some debugging. (This seems like something which could be
> > > of good general use, and as such I'd like to hash it out, do it once,
> > > and do it right)
> >
> > I'd suggest looking at log4j [1] or the python logging [2] packages.
> <snip>
> 
> There is a Perl-based version of log4j, which would fit into Parrot much
> better than Java would:
> 
> http://search.cpan.org/~mschilli/Log-Log4perl-0.48/lib/Log/Log4perl.pm
> 
> 
> 


-- 
"Computer Science is merely the post-Turing Decline of Formal Systems Theory."
-???

Reply via email to