diff --git a/configure.ac b/configure.ac index b5cc7284deeead22a534c5e5b0e8fc814836fc3a..bdc1e458aa2e48b996a7ad92cb570bdca4bc3983 100644 --- a/configure.ac +++ b/configure.ac @@ -56,8 +56,25 @@ dnl silent automake requires version 1.11 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_ARG_ENABLE([developer], + [AS_HELP_STRING([--enable-developer], + [Enable developer build (more logging, address santizer, ... (default: no))])], + [enable_devel=$enabkeval], + [enable_devel=no]) +AS_IF([test "x$enable_devel" != "xno"], + [ dnl enable ASAN for developers + enable_asan=yes + dnl include NOISE level debugging ability, but default to DEBUG + CPPFLAGS="-DMSTRO_DEFAULT_LOG_LEVEL=3 -DMSTRO_MAX_DEBUG_LEVEL=4 $CPPFLAGS" + + ], + [ dnl set logging to ERR, and limit logging to DEBUG + CPPFLAGS="-DMSTRO_DEFAULT_LOG_LEVEL=0 -DMSTRO_MAX_DEBUG_LEVEL=3 $CPPFLAGS" + ]) + + AC_ARG_ENABLE([numa], - [AS_HELP_STRING([--enable-numa],[Disable libnuma usage (default: use if detected)])], + [AS_HELP_STRING([--enable-numa],[Enable libnuma usage (default: use if detected)])], [enable_numa=$enableval],[enable_numa=yes]) AS_IF([test "x$enable_numa" = xyes], [AC_CHECK_HEADERS([numa.h numaif.h], @@ -155,7 +172,8 @@ else fi AC_ARG_ENABLE([asan], - AS_HELP_STRING([--enable-asan],[Enable Address Sanitizer support])) + AS_HELP_STRING([--enable-asan], + [Enable Address Sanitizer support])) if test "x$enable_asan" = "xyes"; then BUILD_ASAN=yes AX_CHECK_COMPILE_FLAG([-fsanitize=address -fno-omit-frame-pointer -Wpedantic -Wextra ], diff --git a/maestro/logging.c b/maestro/logging.c index e2fa553fe77aea0fac92503eed3c92fef076425c..756485f7ab6d4bdd051c15eaeba96414803515ad 100644 --- a/maestro/logging.c +++ b/maestro/logging.c @@ -174,8 +174,16 @@ const char * const mstro_log_labels[MSTRO_log__MAX] = { * * Only messages with level <= g_debug_level will be printed * + * Defaults to the compile-time maximum supported log level + * (MSTRO_MAX_LOG_LEVEL), unless a specific compile value is defined + * for MSTRO_DEFAULT_LOG_LEVEL. + * **/ +#ifdef MSTRO_DEFAULT_LOG_LEVEL +static int g_debug_level = MSTRO_DEFAULT_LOG_LEVEL; +#else static int g_debug_level = MSTRO_MAX_LOG_LEVEL; +#endif /** Log print color */ static enum ansi_color_symbol g_log_color = MSTRO_COLOR_DEFAULT;