AS_HELP_STRING([--enable-debug_enable Turn on debug_enable]),
[debug_enable=yes],
debug_enable=no)
-# check for fatal_on
-AC_ARG_ENABLE([fatal_on],
- AS_HELP_STRING([--enable-fatal_on Turn on fatal assertion]),
- [fatal_on=yes],
- fatal_on=no)
-if test "x$fatal_on" = "xyes" ; then
- DEBUG_CFLAGS+=" -DFATAL_ON"
-fi
AC_SUBST(DEBUG_CFLAGS)
# Checks for libraries.
# Checks for header files.
#include <logcommon.h>
#include "loglimiter.h"
#include "logconfig.h"
-#ifdef FATAL_ON
#include <assert.h>
-#endif
+#include <unistd.h>
+
+#define DEBUGMODE_FILE TZ_SYS_ETC"/.debugmode"
/**
* @brief Points to a function which writes a log message
static int limiter;
static int plog;
+static int debugmode;
/**
* @brief Null handler
write_to_log = __write_to_log_null;
__configure();
__dlog_init_backend();
+ debugmode = access(DEBUGMODE_FILE, F_OK) != -1 ? 1 : 0;
pthread_mutex_unlock(&log_init_lock);
}
*/
void __dlog_fatal_assert(int prio)
{
-#ifdef FATAL_ON
- assert(!(prio == DLOG_FATAL));
-#endif
+ assert(debugmode || !(prio == DLOG_FATAL));
}
/**
vsnprintf(buf, LOG_MAX_SIZE, fmt, ap);
ret = write_to_log(log_id, prio, tag, buf);
-#ifdef FATAL_ON
__dlog_fatal_assert(prio);
-#endif
return ret;
}
va_end(ap);
ret = write_to_log(log_id, prio, tag, buf);
-#ifdef FATAL_ON
__dlog_fatal_assert(prio);
-#endif
return ret;
}