Commit | Line | Data |
---|---|---|
55314f2a | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
55314f2a | 3 | * |
0235b0db | 4 | * Copyright (c) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
55314f2a JG |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef CTF_METADATA_LOGGING_H |
8 | #define CTF_METADATA_LOGGING_H | |
9 | ||
f7b785ac | 10 | #include <babeltrace2/babeltrace.h> |
578e048b | 11 | #include "logging/log.h" |
55314f2a | 12 | |
0746848c PP |
13 | /* |
14 | * This global log level is for the generated lexer and parser: we can't | |
15 | * use a contextual log level for their "tracing", so they rely on this. | |
16 | */ | |
17 | BT_LOG_LEVEL_EXTERN_SYMBOL(ctf_plugin_metadata_log_level); | |
55314f2a | 18 | |
f7b785ac PP |
19 | /* |
20 | * To be used by functions without a context structure to pass all the | |
21 | * logging configuration at once. | |
22 | */ | |
23 | struct meta_log_config { | |
24 | bt_logging_level log_level; | |
25 | ||
26 | /* Weak */ | |
27 | bt_self_component *self_comp; | |
28 | }; | |
29 | ||
ef267d12 PP |
30 | #define _BT_LOGT_LINENO(_lineno, _msg, args...) \ |
31 | BT_LOGT("At line %u in metadata stream: " _msg, _lineno, ## args) | |
28973adf | 32 | |
f73367f8 PP |
33 | #define _BT_LOGW_LINENO(_lineno, _msg, args...) \ |
34 | BT_LOGW("At line %u in metadata stream: " _msg, _lineno, ## args) | |
35 | ||
36 | #define _BT_LOGE_LINENO(_lineno, _msg, args...) \ | |
37 | BT_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args) | |
38 | ||
ef267d12 PP |
39 | #define _BT_COMP_LOGT_LINENO(_lineno, _msg, args...) \ |
40 | BT_COMP_LOGT("At line %u in metadata stream: " _msg, _lineno, ## args) | |
f7b785ac PP |
41 | |
42 | #define _BT_COMP_LOGW_LINENO(_lineno, _msg, args...) \ | |
43 | BT_COMP_LOGW("At line %u in metadata stream: " _msg, _lineno, ## args) | |
44 | ||
45 | #define _BT_COMP_LOGE_LINENO(_lineno, _msg, args...) \ | |
46 | BT_COMP_LOGE("At line %u in metadata stream: " _msg, _lineno, ## args) | |
47 | ||
55314f2a | 48 | #endif /* CTF_METADATA_LOGGING_H */ |