added some stuff so we get debug messages in debug mode!

This commit is contained in:
fishwaldo 2002-11-01 01:32:37 +00:00
parent 89617e48f3
commit 754b2fe924
2 changed files with 8 additions and 5 deletions

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
* *
* $Id: s_debug.c,v 1.4 2002/09/13 06:50:08 fishwaldo Exp $ * $Id: s_debug.c,v 1.5 2002/11/01 01:32:34 fishwaldo Exp $
*/ */
#include "stdinc.h" #include "stdinc.h"
@ -67,15 +67,18 @@ void debug(int level, char *format, ...)
static char debugbuf[1024]; static char debugbuf[1024];
va_list args; va_list args;
int err = errno; int err = errno;
#ifndef DEBUG
if ((debuglevel >= 0) && (level <= debuglevel)) { if ((debuglevel >= 0) && (level <= debuglevel)) {
#endif
va_start(args, format); va_start(args, format);
vsprintf(debugbuf, format, args); vsprintf(debugbuf, format, args);
va_end(args); va_end(args);
ilog(L_DEBUG, "%s", debugbuf); ilog(L_DEBUG, "%s", debugbuf);
#ifndef DEBUG
} }
#endif
errno = err; errno = err;
} /* debug() */ } /* debug() */

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA * USA
* *
* $Id: s_log.c,v 1.4 2002/09/19 05:41:11 fishwaldo Exp $ * $Id: s_log.c,v 1.5 2002/11/01 01:32:37 fishwaldo Exp $
*/ */
#include "stdinc.h" #include "stdinc.h"
@ -122,10 +122,10 @@ ilog(int priority, const char* fmt, ...)
assert(-1 < priority); assert(-1 < priority);
if(fmt == NULL) if(fmt == NULL)
return; return;
#ifndef DEBUG
if (priority > logLevel) if (priority > logLevel)
return; return;
#endif
va_start(args, fmt); va_start(args, fmt);
vsprintf(buf, fmt, args); vsprintf(buf, fmt, args);
va_end(args); va_end(args);