logging-internal.h: add BT_LOG_LEVEL_EXTERN_SYMBOL(), BT_LOG_INIT_LOG_LEVEL()
[babeltrace.git] / include / babeltrace / logging-internal.h
index 8805306e9424228a052dbc0a8b44f8c094264559..df21c21ef9ad5eba3cd27322c97dfa2d5f50e195 100644 (file)
@@ -1004,8 +1004,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.024008 seconds and 4 git commands to generate.