X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Flogging-internal.h;h=ee93660fa677395d9e75f699274962ee0915c463;hb=2e90378a2b94006e2743b06e7fe7a1f0e691a56e;hp=13a36441c56dd29f336ce109440fd666b187bf1b;hpb=263c5cefb0a3faac3f7c4265bbaa0455b04cef8d;p=babeltrace.git diff --git a/include/babeltrace/logging-internal.h b/include/babeltrace/logging-internal.h index 13a36441..ee93660f 100644 --- a/include/babeltrace/logging-internal.h +++ b/include/babeltrace/logging-internal.h @@ -353,10 +353,10 @@ * 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 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 +#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 /* 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 @@ -736,12 +736,12 @@ void _bt_log_write_mem_aux( * - BT_LOGF("format string", args, ...) * * Message and error string (errno) logging macros: - * - BT_LOGV_ERRNO("format string", args, ...) - * - BT_LOGD_ERRNO("format string", args, ...) - * - BT_LOGI_ERRNO("format string", args, ...) - * - BT_LOGW_ERRNO("format string", args, ...) - * - BT_LOGE_ERRNO("format string", args, ...) - * - BT_LOGF_ERRNO("format string", args, ...) + * - BT_LOGV_ERRNO("initial message", "format string", args, ...) + * - BT_LOGD_ERRNO("initial message", "format string", args, ...) + * - BT_LOGI_ERRNO("initial message", "format string", args, ...) + * - BT_LOGW_ERRNO("initial message", "format string", args, ...) + * - BT_LOGE_ERRNO("initial message", "format string", args, ...) + * - BT_LOGF_ERRNO("initial message", "format string", args, ...) * * Memory logging macros: * - BT_LOGV_MEM(data_ptr, data_sz, "format string", args, ...) @@ -837,25 +837,12 @@ void _bt_log_write_mem_aux( } _BT_LOG_ONCE #endif -#if (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE - /* XSI-compliant version of strerror_r(). */ - #define BT_LOG_WRITE_ERRNO(lvl, tag, _msg, _fmt, args...) \ - do { \ - char error_str[BUFSIZ]; \ - memset(error_str, 0, sizeof(error_str)); \ - (void) strerror_r(errno, error_str, sizeof(error_str)); \ - BT_LOG_WRITE(lvl, tag, _msg ": %s. " _fmt, error_str, ## args); \ - } _BT_LOG_ONCE -#else - /* GNU version of strerror_r(). */ - #define BT_LOG_WRITE_ERRNO(lvl, tag, _msg, _fmt, args...) \ - do { \ - char error_str_buf[BUFSIZ]; \ - char *error_str; \ - error_str = strerror_r(errno, error_str_buf, sizeof(error_str_buf)); \ - BT_LOG_WRITE(lvl, tag, _msg ": %s. " _fmt, error_str, ## args); \ - } _BT_LOG_ONCE -#endif +#define BT_LOG_WRITE_ERRNO(lvl, tag, _msg, _fmt, args...) \ + do { \ + const char *error_str; \ + error_str = g_strerror(errno); \ + BT_LOG_WRITE(lvl, tag, _msg ": %s" _fmt, error_str, ## args); \ + } _BT_LOG_ONCE static _BT_LOG_INLINE void _bt_log_unused(const int dummy, ...) {(void)dummy;}