-/* $Id: mmlog.c,v 1.5 2004/03/22 06:59:35 mmondor Exp $ */
+/* $Id: mmlog.c,v 1.6 2005/09/21 10:33:59 mmondor Exp $ */
/*
* Copyright (C) 2000-2004, Matthew Mondor
#include <sys/types.h>
#include <syslog.h>
#include <stdio.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <mmtypes.h>
MMCOPYRIGHT("@(#) Copyright (c) 2000-2004\n\
\tMatthew Mondor. All rights reserved.\n");
-MMRCSID("$Id: mmlog.c,v 1.5 2004/03/22 06:59:35 mmondor Exp $");
+MMRCSID("$Id: mmlog.c,v 1.6 2005/09/21 10:33:59 mmondor Exp $");
va_end(lst);
syslog(LOG_NOTICE, "%s:%s():%d - %s", file, func, line, buf);
}
+
+void
+mmdebug2(const char *file, const char *func, int line, const char *fmt, ...)
+{
+ va_list lst;
+ char buf[1024];
+
+ va_start(lst, fmt);
+ vsnprintf(buf, 1023, fmt, lst);
+ va_end(lst);
+ syslog(LOG_NOTICE, "%s:%s():%d - %s", file, func, line, buf);
+
+ abort();
+}
#endif
-/* $Id: mmlog.h,v 1.15 2004/06/17 13:20:12 mmondor Exp $ */
+/* $Id: mmlog.h,v 1.16 2005/09/21 10:33:59 mmondor Exp $ */
/*
* Copyright (C) 2000-2004, Matthew Mondor
/* Macro similar to assert(3) but which does not exit the application. Will
* instead log the condition.
*/
+#ifdef DEBUG_ASSERT_ABORT
+#define DEBUG_ASSERT(c) if (!(c)) \
+ mmdebug2(__FILE__, __func__, __LINE__, "DEBUG_ASSERT(" #c ") == %d", c);
+#else
#define DEBUG_ASSERT(c) if (!(c)) \
mmdebug(__FILE__, __func__, __LINE__, "DEBUG_ASSERT(" #c ") == %d", c);
+#endif
#else