Fix build with BUILT_IN_PLUGINS=1
[babeltrace.git] / include / babeltrace / logging-internal.h
index e9ce365e19281f8b478960f760b9ccbe68b505b1..d7a10a1339c8f0962e35231fad2aa4d4f102b774 100644 (file)
 #if defined(BT_LOG_OUTPUT_LEVEL)
        #define _BT_LOG_OUTPUT_LEVEL BT_LOG_OUTPUT_LEVEL
 #else
-       #define _BT_LOG_OUTPUT_LEVEL _bt_log_global_output_lvl
+       /*
+        * We disallow this to make sure Babeltrace modules always
+        * have their own local log level.
+        */
+       #error No log level symbol specified: please define BT_LOG_OUTPUT_LEVEL before including this header.
 #endif
 
 /* "Tag" is a compound string that could be associated with a log message. It
 #if defined(__printflike)
        #define _BT_LOG_PRINTFLIKE(str_index, first_to_check) \
                __printflike(str_index, first_to_check)
+#elif defined(__MINGW_PRINTF_FORMAT)
+       #define _BT_LOG_PRINTFLIKE(str_index, first_to_check) \
+               __attribute__((format(__MINGW_PRINTF_FORMAT, str_index, first_to_check)))
 #elif defined(__GNUC__)
        #define _BT_LOG_PRINTFLIKE(str_index, first_to_check) \
                __attribute__((format(__printf__, str_index, first_to_check)))
@@ -947,6 +954,8 @@ extern "C" {
  *   bt_log_set_output_v(BT_LOG_OUT_STDERR);
  */
 enum { BT_LOG_OUT_STDERR_MASK = BT_LOG_PUT_STD };
+
+BT_HIDDEN
 void bt_log_out_stderr_callback(const bt_log_message *const msg, void *arg);
 #define BT_LOG_OUT_STDERR BT_LOG_OUT_STDERR_MASK, 0, bt_log_out_stderr_callback
 
@@ -1000,8 +1009,19 @@ end:
        return level;
 }
 
+#define BT_LOG_LEVEL_EXTERN_SYMBOL(_level_sym)                         \
+       extern int _level_sym
+
+#define BT_LOG_INIT_LOG_LEVEL(_level_sym, _env_var)                    \
+       BT_HIDDEN int _level_sym = BT_LOG_NONE;                         \
+       static                                                          \
+       void __attribute__((constructor)) _bt_log_level_ctor(void)      \
+       {                                                               \
+               _level_sym = bt_log_get_level_from_env(_env_var);       \
+       }
+
 #ifdef __cplusplus
 }
 #endif
 
-#endif
+#endif /* BABELTRACE_LOGGING_INTERNAL_H */
This page took 0.024228 seconds and 4 git commands to generate.