X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Fcommon%2Fmetadata%2Flogging.h;h=4488b620b40d67989ca3ed2e9d8c76a6e0ab34fd;hp=14b5fdc48c5e11e80a3c0562299d5989cceb8162;hb=50f6fce8d00bc6b70a814a0be3b71570fb65d070;hpb=49a43e69c6ca442956f894029d0d8e2acae8b041 diff --git a/src/plugins/ctf/common/metadata/logging.h b/src/plugins/ctf/common/metadata/logging.h index 14b5fdc4..4488b620 100644 --- a/src/plugins/ctf/common/metadata/logging.h +++ b/src/plugins/ctf/common/metadata/logging.h @@ -23,8 +23,9 @@ BT_LOG_LEVEL_EXTERN_SYMBOL(ctf_plugin_metadata_log_level); struct meta_log_config { bt_logging_level log_level; - /* Weak */ + /* Weak, exactly one of these must be set */ bt_self_component *self_comp; + bt_self_component_class *self_comp_class; }; #define _BT_LOGT_LINENO(_lineno, _msg, args...) \ @@ -33,8 +34,12 @@ struct meta_log_config { #define _BT_LOGW_LINENO(_lineno, _msg, args...) \ BT_LOGW("At line %u in metadata stream: " _msg, _lineno, ## args) -#define _BT_LOGE_LINENO(_lineno, _msg, args...) \ - BT_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args) +#define _BT_LOGE_APPEND_CAUSE_LINENO(_lineno, _msg, args...) \ + do { \ + BT_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args); \ + (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN( \ + "CTF metadata parser", "At line %u in metadata stream: " _msg, _lineno, ## args); \ + } while (0) #define _BT_COMP_LOGT_LINENO(_lineno, _msg, args...) \ BT_COMP_LOGT("At line %u in metadata stream: " _msg, _lineno, ## args) @@ -45,4 +50,13 @@ struct meta_log_config { #define _BT_COMP_LOGE_LINENO(_lineno, _msg, args...) \ BT_COMP_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args) +#define _BT_COMP_LOGE_APPEND_CAUSE_LINENO(_lineno, _msg, args...) \ + BT_COMP_LOGE_APPEND_CAUSE(BT_COMP_LOG_SELF_COMP, "At line %u in metadata stream: " _msg, _lineno, ## args) + +#define _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(_msg, args...) \ + BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE( \ + BT_COMP_LOG_SELF_COMP, \ + BT_COMP_LOG_SELF_COMP_CLASS, \ + _msg, ## args) + #endif /* CTF_METADATA_LOGGING_H */