fi
AC_SUBST(EINA_CONFIGURE_SAFETY_CHECKS)
+with_max_log_level="<unset>"
+AC_ARG_WITH(internal-maximum-log-level,
+ [AC_HELP_STRING([--with-internal-maximum-log-level=NUMBER],
+ [limit eina internal log level to the given number, any call to EINA_LOG() with values greater than this will be compiled out, ignoring runtime settings, but saving function calls.])],
+ [
+ if test "x${withval}" != "xno"; then
+ if echo "${withval}" | grep '^[[0-9]]\+$' >/dev/null 2>/dev/null; then
+ AC_MSG_NOTICE([ignoring any EINA_LOG() with level greater than ${withval}])
+ AC_DEFINE_UNQUOTED(EINA_LOG_LEVEL_MAXIMUM, ${withval}, [if set, logging is limited to this amount.])
+ with_max_log_level="${withval}"
+ else
+ AC_MSG_ERROR([--with-internal-maximum-log-level takes a decimal number, got "${withval}" instead.])
+ fi
+ fi
+ ], [:])
+
+
# Choose best memory pool
AC_ARG_ENABLE([default-mempool],
[AC_HELP_STRING([--enable-default-mempool], [Default memory allocator could be faster for some computer. @<:@default=disabled@:>@])],
echo
echo " Magic debug..........: ${have_magic_debug}"
echo " Safety checks........: ${have_safety_checks}"
+echo " Maximum log level....: ${with_max_log_level}"
echo " Report string usage..: ${have_stringshare_usage}"
echo " Default mempool......: ${have_default_mempool}"
echo " Thread Support.......: ${have_pthread}"
/**
* @def EINA_LOG(DOM, LEVEL, fmt, ...)
* Logs a message on the specified domain, level and format.
- */
+ *
+ * @note if @c EINA_LOG_LEVEL_MAXIMUM is defined, then messages larger
+ * than this value will be ignored regardless of current domain
+ * level, the eina_log_print() is not even called! Most
+ * compilers will just detect the two integers make the branch
+ * impossible and remove the branch and function call all
+ * together. Take this as optimization tip and possible remove
+ * debug messages from binaries to be deployed, saving on hot
+ * paths. Never define @c EINA_LOG_LEVEL_MAXIMUM on public
+ * header files.
+ */
+#ifdef EINA_LOG_LEVEL_MAXIMUM
+#define EINA_LOG(DOM, LEVEL, fmt, ...) \
+ do { \
+ if (LEVEL <= EINA_LOG_LEVEL_MAXIMUM) \
+ eina_log_print(DOM, LEVEL, __FILE__, __FUNCTION__, __LINE__, \
+ fmt, ##__VA_ARGS__); \
+ } while (0)
+#else
#define EINA_LOG(DOM, LEVEL, fmt, ...) \
eina_log_print(DOM, LEVEL, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+#endif
/**
* @def EINA_LOG_DOM_CRIT(DOM, fmt, ...)