Move to kernel style SPDX license identifiers
[babeltrace.git] / src / logging / comp-logging.h
index 586486034cb990fb22ae68ad610e03a84093e93b..d4ce06086498021790db6ff971baace0036997d0 100644 (file)
@@ -1,28 +1,12 @@
-#ifndef BABELTRACE_LOGGING_COMP_LOGGING_H
-#define BABELTRACE_LOGGING_COMP_LOGGING_H
-
 /*
- * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
+ * SPDX-License-Identifier: MIT
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
  */
 
+#ifndef BABELTRACE_LOGGING_COMP_LOGGING_H
+#define BABELTRACE_LOGGING_COMP_LOGGING_H
+
 #ifndef BT_LOG_TAG
 # error Please define a tag with BT_LOG_TAG before including this file.
 #endif
                }                                                                               \
        } while (0)
 
+/*
+ * Logs error and appends error cause from message iterator context.
+ *
+ * There is no BT_SELF_MSG_LOGE yet, so use BT_COMP_LOGE for now.
+ */
+#define BT_MSG_ITER_LOGE_APPEND_CAUSE(_self_msg_iter, _fmt, ...)                                       \
+       do {                                                                                            \
+               BT_COMP_LOG(BT_LOG_ERROR, bt_self_message_iterator_borrow_component(_self_msg_iter),    \
+                       _fmt, ##__VA_ARGS__);                                                           \
+               (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_MESSAGE_ITERATOR(                      \
+                       _self_msg_iter, _fmt, ##__VA_ARGS__);                                           \
+       } while (0)
+
 #endif /* BABELTRACE_LOGGING_COMP_LOGGING_H */
This page took 0.024015 seconds and 4 git commands to generate.