-#ifndef BABELTRACE_LOGGING_COMP_LOGGING_H
-#define BABELTRACE_LOGGING_COMP_LOGGING_H
-
/*
- * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
- *
- * 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.
+ * SPDX-License-Identifier: MIT
*
- * 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
/* Logs with level `_lvl` for self component `_self_comp` */
#define BT_COMP_LOG(_lvl, _self_comp, _fmt, ...) \
- BT_LOG_WRITE((_lvl), BT_LOG_TAG, _BT_COMP_LOG_COMP_PREFIX _fmt, \
+ BT_LOG_WRITE_PRINTF_CUR_LVL((enum bt_log_level) (_lvl), \
+ (enum bt_log_level) (BT_LOG_OUTPUT_LEVEL), BT_LOG_TAG, \
+ _BT_COMP_LOG_COMP_PREFIX _fmt, \
(_self_comp) ? \
bt_component_get_name( \
bt_self_component_as_component(_self_comp)) : \
/* Logs with level `_lvl` for self component class `_self_comp_class` */
#define BT_COMP_CLASS_LOG(_lvl, _self_comp_class, _fmt, ...) \
- BT_LOG_WRITE((_lvl), BT_LOG_TAG, _BT_COMP_LOG_COMP_PREFIX _fmt, \
+ BT_LOG_WRITE_PRINTF_CUR_LVL((enum bt_log_level) (_lvl), \
+ (enum bt_log_level) (BT_LOG_OUTPUT_LEVEL), BT_LOG_TAG, \
+ _BT_COMP_LOG_COMP_PREFIX _fmt, \
bt_component_class_get_name( \
bt_self_component_class_as_component_class( \
_self_comp_class)), ##__VA_ARGS__)
#define BT_COMP_LOG_CUR_LVL(_lvl, _cur_lvl, _self_comp, _fmt, ...) \
- BT_LOG_WRITE_CUR_LVL((_lvl), (_cur_lvl), BT_LOG_TAG, \
+ BT_LOG_WRITE_PRINTF_CUR_LVL((enum bt_log_level) (_lvl), \
+ (enum bt_log_level) (_cur_lvl), BT_LOG_TAG, \
_BT_COMP_LOG_COMP_PREFIX _fmt, \
(_self_comp) ? \
bt_component_get_name( \
##__VA_ARGS__)
#define BT_COMP_LOG_ERRNO(_lvl, _self_comp, _msg, _fmt, ...) \
- BT_LOG_WRITE_ERRNO((_lvl), BT_LOG_TAG, _msg, \
+ BT_LOG_WRITE_ERRNO_PRINTF_CUR_LVL((enum bt_log_level) (_lvl), \
+ (enum bt_log_level) (BT_LOG_OUTPUT_LEVEL), \
+ BT_LOG_TAG, _msg, \
_BT_COMP_LOG_COMP_PREFIX _fmt, \
(_self_comp) ? \
bt_component_get_name( \
##__VA_ARGS__)
#define BT_COMP_LOG_ERRNO_CUR_LVL(_lvl, _cur_lvl, _self_comp, _msg, _fmt, ...) \
- BT_LOG_WRITE_ERRNO_CUR_LVL((_lvl), (_cur_lvl), BT_LOG_TAG, _msg, \
+ BT_LOG_WRITE_ERRNO_PRINTF_CUR_LVL((enum bt_log_level) (_lvl), \
+ (enum bt_log_level) (_cur_lvl), BT_LOG_TAG, _msg, \
_BT_COMP_LOG_COMP_PREFIX _fmt, \
(_self_comp) ? \
bt_component_get_name( \
##__VA_ARGS__)
#define BT_COMP_LOG_MEM(_lvl, _self_comp, _data_ptr, _data_sz, _fmt, ...) \
- BT_LOG_WRITE_MEM((_lvl), BT_LOG_TAG, (_data_ptr), (_data_sz), \
+ BT_LOG_WRITE_MEM_PRINTF_CUR_LVL((enum bt_log_level) (_lvl), \
+ (enum bt_log_level) (BT_LOG_OUTPUT_LEVEL), BT_LOG_TAG, \
+ (_data_ptr), (_data_sz), \
_BT_COMP_LOG_COMP_PREFIX _fmt, \
(_self_comp) ? \
bt_component_get_name( \
/* Logs error and errno string from component class context. */
#define BT_COMP_CLASS_LOG_ERRNO(_lvl, _self_comp_class, _msg, _fmt, ...) \
- BT_LOG_WRITE_ERRNO((_lvl), BT_LOG_TAG, _msg, \
+ BT_LOG_WRITE_ERRNO_PRINTF_CUR_LVL((enum bt_log_level) (_lvl), \
+ (enum bt_log_level) (BT_LOG_OUTPUT_LEVEL), BT_LOG_TAG, _msg, \
_BT_COMP_LOG_COMP_PREFIX _fmt, \
bt_component_class_get_name( \
bt_self_component_class_as_component_class(_self_comp_class)) \