Visibility hidden by default
[babeltrace.git] / src / logging / log.h
index f32419e1a99a42ac24d8741fa2c60546b3a4de93..ce4299fbb994aa5417195e0b6472948900c9d463 100644 (file)
@@ -1,7 +1,10 @@
 /*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright (c) 2016 wonder-mice
+ *
  * This is zf_log.h, modified with Babeltrace prefixes.
  * See <https://github.com/wonder-mice/zf_log/>.
- * See logging/LICENSE in the Babeltrace source tree.
  */
 
 #pragma once
  * corresponding BT_LOG_DEFINE_XXX macro MUST be used exactly once somewhere.
  * Otherwise build will fail with link error (undefined symbol).
  */
-#define BT_LOG_DEFINE_TAG_PREFIX BT_HIDDEN const char *_bt_log_tag_prefix
-#define BT_LOG_DEFINE_GLOBAL_FORMAT BT_HIDDEN bt_log_format _bt_log_global_format
-#define BT_LOG_DEFINE_GLOBAL_OUTPUT BT_HIDDEN bt_log_output _bt_log_global_output
-#define BT_LOG_DEFINE_GLOBAL_OUTPUT_LEVEL BT_HIDDEN int _bt_log_global_output_lvl
+#define BT_LOG_DEFINE_TAG_PREFIX const char *_bt_log_tag_prefix
+#define BT_LOG_DEFINE_GLOBAL_FORMAT bt_log_format _bt_log_global_format
+#define BT_LOG_DEFINE_GLOBAL_OUTPUT bt_log_output _bt_log_global_output
+#define BT_LOG_DEFINE_GLOBAL_OUTPUT_LEVEL int _bt_log_global_output_lvl
 
 /* Pointer to global format options. Direct modification is not allowed. Use
  * bt_log_set_mem_width() instead. Could be used to initialize bt_log_spec
@@ -641,9 +644,9 @@ bt_log_spec;
  * See BT_LOG_OUTPUT_LEVEL for details.
  */
 #define BT_LOG_ON_CUR_LVL(lvl, cur_lvl) \
-               (BT_LOG_ENABLED((lvl)) && (lvl) >= (cur_lvl))
+               G_UNLIKELY(BT_LOG_ENABLED((lvl)) && (lvl) >= (cur_lvl))
 #define BT_LOG_ON(lvl) \
-               (BT_LOG_ENABLED((lvl)) && (lvl) >= _BT_LOG_OUTPUT_LEVEL)
+               G_UNLIKELY(BT_LOG_ENABLED((lvl)) && (lvl) >= _BT_LOG_OUTPUT_LEVEL)
 #define BT_LOG_ON_TRACE     BT_LOG_ON(BT_LOG_TRACE)
 #define BT_LOG_ON_DEBUG     BT_LOG_ON(BT_LOG_DEBUG)
 #define BT_LOG_ON_INFO      BT_LOG_ON(BT_LOG_INFO)
@@ -661,49 +664,41 @@ extern bt_log_output _bt_log_global_output;
 extern int _bt_log_global_output_lvl;
 extern const bt_log_spec _bt_log_stderr_spec;
 
-BT_HIDDEN
 void _bt_log_write_d(
                const char *const func, const char *const file, const unsigned line,
                const int lvl, const char *const tag,
                const char *const fmt, ...) _BT_LOG_PRINTFLIKE(6, 7);
 
-BT_HIDDEN
 void _bt_log_write_aux_d(
                const char *const func, const char *const file, const unsigned line,
                const bt_log_spec *const log, const int lvl, const char *const tag,
                const char *const fmt, ...) _BT_LOG_PRINTFLIKE(7, 8);
 
-BT_HIDDEN
 void _bt_log_write(
                const int lvl, const char *const tag,
                const char *const fmt, ...) _BT_LOG_PRINTFLIKE(3, 4);
 
-BT_HIDDEN
 void _bt_log_write_aux(
                const bt_log_spec *const log, const int lvl, const char *const tag,
                const char *const fmt, ...) _BT_LOG_PRINTFLIKE(4, 5);
 
-BT_HIDDEN
 void _bt_log_write_mem_d(
                const char *const func, const char *const file, const unsigned line,
                const int lvl, const char *const tag,
                const void *const d, const unsigned d_sz,
                const char *const fmt, ...) _BT_LOG_PRINTFLIKE(8, 9);
 
-BT_HIDDEN
 void _bt_log_write_mem_aux_d(
                const char *const func, const char *const file, const unsigned line,
                const bt_log_spec *const log, const int lvl, const char *const tag,
                const void *const d, const unsigned d_sz,
                const char *const fmt, ...) _BT_LOG_PRINTFLIKE(9, 10);
 
-BT_HIDDEN
 void _bt_log_write_mem(
                const int lvl, const char *const tag,
                const void *const d, const unsigned d_sz,
                const char *const fmt, ...) _BT_LOG_PRINTFLIKE(5, 6);
 
-BT_HIDDEN
 void _bt_log_write_mem_aux(
                const bt_log_spec *const log, const int lvl, const char *const tag,
                const void *const d, const unsigned d_sz,
@@ -993,7 +988,6 @@ extern "C" {
  */
 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
 
@@ -1122,7 +1116,7 @@ end:
        extern int _level_sym
 
 #define BT_LOG_INIT_LOG_LEVEL(_level_sym, _env_var)                    \
-       BT_HIDDEN int _level_sym = BT_LOG_NONE;                         \
+       int _level_sym = BT_LOG_NONE;                           \
        static                                                          \
        void __attribute__((constructor)) _bt_log_level_ctor(void)      \
        {                                                               \
This page took 0.024338 seconds and 4 git commands to generate.