debugging/logging macros

Matt Crawford matt at oddjob.UUCP
Sun Sep 28 14:13:02 AEST 1986


The way net.sources is going, I should write a 4KB man page for
this and shar it up and post it there!

I like the following logging/debugging macro

#ifndef LOGLEVEL
#define LOGLEVEL 0
#endif

#define LOG(n)	if ( (n) > LOGLEVEL ) ; else fprintf

use it like this:

  LOG(1)(stderr, "LISM model server starting at %s\n", tstamp());

You could instead make LOGLEVEL a variable and catch a signal to
toggle it.
_____________________________________________________
Matt		University	crawford at anl-mcs.arpa
Crawford	of Chicago	ihnp4!oddjob!matt



More information about the Comp.lang.c mailing list