Fix: define macros for logging levels
[babeltrace.git] / src / logging / log.h
index 236f28f5468359ab139f3e7e4398dc668fd7fb7d..14062fa122ea2538eca594cb2ee4db4db5df3cfc 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <babeltrace2/logging.h>
+#include <babeltrace2/babeltrace.h>
+
+/* Access private __BT_LOGGING_LEVEL_* macros. */
+#define __BT_IN_BABELTRACE_H
+#include <babeltrace2/logging-defs.h>
+#undef __BT_IN_BABELTRACE_H
+
 #include "common/macros.h"
 #include "common/assert.h"
 
  * should be empty or very small. Choosing a right log level is as important as
  * providing short and self descriptive log message.
  */
-#define BT_LOG_TRACE   BT_LOGGING_LEVEL_TRACE
-#define BT_LOG_DEBUG   BT_LOGGING_LEVEL_DEBUG
-#define BT_LOG_INFO    BT_LOGGING_LEVEL_INFO
-#define BT_LOG_WARNING BT_LOGGING_LEVEL_WARNING
-#define BT_LOG_ERROR   BT_LOGGING_LEVEL_ERROR
-#define BT_LOG_FATAL   BT_LOGGING_LEVEL_FATAL
-#define BT_LOG_NONE    BT_LOGGING_LEVEL_NONE
+#define BT_LOG_TRACE   __BT_LOGGING_LEVEL_TRACE
+#define BT_LOG_DEBUG   __BT_LOGGING_LEVEL_DEBUG
+#define BT_LOG_INFO    __BT_LOGGING_LEVEL_INFO
+#define BT_LOG_WARNING __BT_LOGGING_LEVEL_WARNING
+#define BT_LOG_ERROR   __BT_LOGGING_LEVEL_ERROR
+#define BT_LOG_FATAL   __BT_LOGGING_LEVEL_FATAL
+#define BT_LOG_NONE    __BT_LOGGING_LEVEL_NONE
 
 /* "Current" log level is a compile time check and has no runtime overhead. Log
  * level that is below current log level it said to be "disabled".
 #define BT_LOG_SRCLOC_SHORT 1
 #define BT_LOG_SRCLOC_LONG  2
 
-/* Source location format is configured per compilation module (.c/.cpp/.m
- * file) by defining BT_LOG_DEF_SRCLOC or BT_LOG_SRCLOC. BT_LOG_SRCLOC has
- * higer priority and when defined overrides value provided by
- * BT_LOG_DEF_SRCLOC.
- *
- * Common practice is to define default format with BT_LOG_DEF_SRCLOC in
- * build script (e.g. Makefile, CMakeLists.txt, gyp, etc.) for the entire
- * project or target:
- *
- *   CC_ARGS := -DBT_LOG_DEF_SRCLOC=BT_LOG_SRCLOC_LONG
- *
- * And when necessary to override it with BT_LOG_SRCLOC in .c/.cpp/.m files
- * before including bt_log.h:
- *
- *   #define BT_LOG_SRCLOC BT_LOG_SRCLOC_NONE
- *   #include "logging.h"
- *
- * If both BT_LOG_DEF_SRCLOC and BT_LOG_SRCLOC are undefined, then
- * BT_LOG_SRCLOC_NONE will be used for release builds (BT_DEBUG_MODE is
- * NOT defined) and BT_LOG_SRCLOC_LONG otherwise (BT_DEBUG_MODE is
- * defined).
- */
-#if defined(BT_LOG_SRCLOC)
-       #define _BT_LOG_SRCLOC BT_LOG_SRCLOC
-#elif defined(BT_LOG_DEF_SRCLOC)
-       #define _BT_LOG_SRCLOC BT_LOG_DEF_SRCLOC
-#else
-       #ifdef BT_DEBUG_MODE
-               #define _BT_LOG_SRCLOC BT_LOG_SRCLOC_LONG
-       #else
-               #define _BT_LOG_SRCLOC BT_LOG_SRCLOC_NONE
-       #endif
-#endif
+#define _BT_LOG_SRCLOC BT_LOG_SRCLOC_LONG
+
 #if BT_LOG_SRCLOC_LONG == _BT_LOG_SRCLOC
        #define _BT_LOG_SRCLOC_FUNCTION _BT_LOG_FUNCTION
 #else
This page took 0.034147 seconds and 4 git commands to generate.