logging: strip down and clean `log.h` and `log.c`
[babeltrace.git] / src / cli / logging.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2017 Philippe Proulx <pproulx@efficios.com>
5 */
6
7 #ifndef CLI_LOGGING_H
8 #define CLI_LOGGING_H
9
10 #define BT_LOG_OUTPUT_LEVEL bt_cli_log_level
11 #include "logging/log.h"
12
13 BT_LOG_LEVEL_EXTERN_SYMBOL(bt_cli_log_level);
14
15 #define BT_CLI_LOG_AND_APPEND(_lvl, _fmt, ...) \
16 do { \
17 BT_LOG_WRITE_PRINTF(_lvl, BT_LOG_TAG, _fmt, ##__VA_ARGS__); \
18 (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN( \
19 "Babeltrace CLI", _fmt, ##__VA_ARGS__); \
20 } while (0)
21
22 #define BT_CLI_LOGE_APPEND_CAUSE(_fmt, ...) \
23 BT_CLI_LOG_AND_APPEND(BT_LOG_ERROR, _fmt, ##__VA_ARGS__)
24 #define BT_CLI_LOGW_APPEND_CAUSE(_fmt, ...) \
25 BT_CLI_LOG_AND_APPEND(BT_LOG_WARNING, _fmt, ##__VA_ARGS__)
26
27 #endif /* CLI_LOGGING_H */
This page took 0.030834 seconds and 4 git commands to generate.