From: Philippe Proulx Date: Sat, 15 Jun 2019 17:02:55 +0000 (-0400) Subject: lib: rename `lib-logging.h` to `logging.h` X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=c2d9d9cf280189e77453e82e4979c307eef111e7 lib: rename `lib-logging.h` to `logging.h` Now we include "lib/logging.h" instead of "lib/lib-logging.h" to get internal library logging support. The old file name was redundant. Signed-off-by: Philippe Proulx Change-Id: I996b58c4b8c4914207a9f7e0b8ff6146ad65f5cb Reviewed-on: https://review.lttng.org/c/babeltrace/+/1473 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 51da351b..84e05257 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -6,7 +6,7 @@ libbabeltrace2_la_SOURCES = \ assert-pre.h \ babeltrace2.c \ lib-logging.c \ - lib-logging.h \ + logging.h \ logging.c \ object.h \ object-pool.c \ diff --git a/src/lib/assert-pre.h b/src/lib/assert-pre.h index 9eeff141..1f4240eb 100644 --- a/src/lib/assert-pre.h +++ b/src/lib/assert-pre.h @@ -25,10 +25,10 @@ */ /* - * The macros in this header use macros defined in "lib/lib-logging.h". + * The macros in this header use macros defined in "lib/logging.h". * We don't want this header to automatically include - * "lib/lib-logging.h" because you need to manually define BT_LOG_TAG - * before including "lib/lib-logging.h" and it is unexpected that you + * "lib/logging.h" because you need to manually define BT_LOG_TAG + * before including "lib/logging.h" and it is unexpected that you * also need to define it before including this header. * * This is a reminder that in order to use "lib/assert-pre.h", you also @@ -36,7 +36,7 @@ */ #ifndef BT_LIB_LOG_SUPPORTED -# error Include "lib/lib-logging.h" before this header. +# error Include "lib/logging.h" before this header. #endif #include diff --git a/src/lib/graph/component-class-sink-colander.c b/src/lib/graph/component-class-sink-colander.c index c20ff5ec..8a238f81 100644 --- a/src/lib/graph/component-class-sink-colander.c +++ b/src/lib/graph/component-class-sink-colander.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/COLANDER" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/component-class.c b/src/lib/graph/component-class.c index 24a32ffc..ad176f72 100644 --- a/src/lib/graph/component-class.c +++ b/src/lib/graph/component-class.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/COMPONENT-CLASS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/component-filter.c b/src/lib/graph/component-filter.c index 259ba626..a39e7e5a 100644 --- a/src/lib/graph/component-filter.c +++ b/src/lib/graph/component-filter.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/COMPONENT-FILTER" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/component-sink.c b/src/lib/graph/component-sink.c index 6cb9187c..fe25db6e 100644 --- a/src/lib/graph/component-sink.c +++ b/src/lib/graph/component-sink.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/COMPONENT-SINK" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/component-source.c b/src/lib/graph/component-source.c index 404da691..53d8b6d4 100644 --- a/src/lib/graph/component-source.c +++ b/src/lib/graph/component-source.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/COMPONENT-SOURCE" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/component.c b/src/lib/graph/component.c index b02d2a8c..7a6e8b02 100644 --- a/src/lib/graph/component.c +++ b/src/lib/graph/component.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/COMPONENT" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/common.h" #include "common/assert.h" diff --git a/src/lib/graph/connection.c b/src/lib/graph/connection.c index 8c31c38e..98379daf 100644 --- a/src/lib/graph/connection.c +++ b/src/lib/graph/connection.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/CONNECTION" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/graph.c b/src/lib/graph/graph.c index 70d958fc..734ebb7e 100644 --- a/src/lib/graph/graph.c +++ b/src/lib/graph/graph.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/GRAPH" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index 1303003f..a72611f6 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/MSG-ITER" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "compat/compiler.h" #include "lib/trace-ir/clock-class.h" diff --git a/src/lib/graph/message/discarded-items.c b/src/lib/graph/message/discarded-items.c index 25836dc3..b38f8fac 100644 --- a/src/lib/graph/message/discarded-items.c +++ b/src/lib/graph/message/discarded-items.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/MSG-DISCARDED-ITEMS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include "lib/object.h" diff --git a/src/lib/graph/message/event.c b/src/lib/graph/message/event.c index 8468186c..57f8c429 100644 --- a/src/lib/graph/message/event.c +++ b/src/lib/graph/message/event.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/MSG-EVENT" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/message/message-iterator-inactivity.c b/src/lib/graph/message/message-iterator-inactivity.c index 0c89d84c..f1b94dd0 100644 --- a/src/lib/graph/message/message-iterator-inactivity.c +++ b/src/lib/graph/message/message-iterator-inactivity.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/MSG-MSG-ITER-INACTIVITY" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include "lib/object.h" diff --git a/src/lib/graph/message/message.c b/src/lib/graph/message/message.c index 25afe1a5..d720a3bd 100644 --- a/src/lib/graph/message/message.c +++ b/src/lib/graph/message/message.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/MSG" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/message/packet.c b/src/lib/graph/message/packet.c index 4a5a3e39..88de665b 100644 --- a/src/lib/graph/message/packet.c +++ b/src/lib/graph/message/packet.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/MSG-PACKET" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "compat/compiler.h" #include diff --git a/src/lib/graph/message/stream-activity.c b/src/lib/graph/message/stream-activity.c index dd8bd7e5..21275c1f 100644 --- a/src/lib/graph/message/stream-activity.c +++ b/src/lib/graph/message/stream-activity.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/MSG-STREAM-ACTIVITY" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include "lib/object.h" diff --git a/src/lib/graph/message/stream.c b/src/lib/graph/message/stream.c index ba8a91fa..44c1a2d9 100644 --- a/src/lib/graph/message/stream.c +++ b/src/lib/graph/message/stream.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/MSG-STREAM" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include "compat/compiler.h" diff --git a/src/lib/graph/port.c b/src/lib/graph/port.c index bf768ad0..df7c84df 100644 --- a/src/lib/graph/port.c +++ b/src/lib/graph/port.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/PORT" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/graph/query-executor.c b/src/lib/graph/query-executor.c index 597804e6..6d533445 100644 --- a/src/lib/graph/query-executor.c +++ b/src/lib/graph/query-executor.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/QUERY-EXECUTOR" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "common/common.h" diff --git a/src/lib/lib-logging.c b/src/lib/lib-logging.c index 1433489b..60ed8b6b 100644 --- a/src/lib/lib-logging.c +++ b/src/lib/lib-logging.c @@ -59,7 +59,7 @@ #include "graph/message/stream-activity.h" #include "graph/message/stream.h" #include "graph/port.h" -#include "lib-logging.h" +#include "logging.h" #include "plugin/plugin.h" #include "plugin/plugin-so.h" #include "trace-ir/clock-class.h" diff --git a/src/lib/lib-logging.h b/src/lib/lib-logging.h deleted file mode 100644 index 7bb36c99..00000000 --- a/src/lib/lib-logging.h +++ /dev/null @@ -1,195 +0,0 @@ -#ifndef BABELTRACE_LIB_LOGGING_INTERNAL_H -#define BABELTRACE_LIB_LOGGING_INTERNAL_H - -/* - * Copyright 2017-2018 Philippe Proulx - * - * 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. - */ - -#include "common/macros.h" -#include - -#ifndef BT_LOG_TAG -# error Please define a tag with BT_LOG_TAG before including this file. -#endif - -#define BT_LOG_OUTPUT_LEVEL bt_lib_log_level - -#include "logging/log.h" - -extern -int bt_lib_log_level; - -#define BT_LIB_LOG(_lvl, _fmt, ...) \ - do { \ - if (BT_LOG_ON(_lvl)) { \ - bt_lib_log(_BT_LOG_SRCLOC_FUNCTION, __FILE__, \ - __LINE__, _lvl, _BT_LOG_TAG, \ - (_fmt), ##__VA_ARGS__); \ - } \ - } while (0) - -/* - * The six macros below are logging statements which are specialized - * for the Babeltrace library. - * - * `_fmt` is a typical printf()-style format string, with the following - * limitations: - * - * * The `*` width specifier is not accepted. - * * The `*` precision specifier is not accepted. - * * The `j` and `t` length modifiers are not accepted. - * * The `n` format specifier is not accepted. - * * The format specifiers defined in are not accepted - * except for `PRId64`, `PRIu64`, `PRIx64`, `PRIX64`, `PRIo64`, and - * `PRIi64`. - * - * The Babeltrace extension conversion specifier is accepted. Its syntax - * is either `%!u` to format a UUID (`bt_uuid` type) or: - * - * 1. Introductory `%!` sequence. - * - * 2. Optional: `[` followed by a custom prefix for the printed fields - * of this specifier, followed by `]`. The standard form is to end - * this prefix with `-` so that, for example, with the prefix - * `prefix-`, the complete field name is `prefix-addr`. - * - * 3. Optional: `+` to print extended fields. This depends on the - * provided format specifier. - * - * 4. Format specifier (see below). - * - * The available format specifiers are: - * - * `F`: - * Trace IR field class. The parameter type is - * `struct bt_field_class *`. - * - * `f`: - * Trace IR field. The parameter type is `struct bt_field *`. - * - * `P`: - * Field path. The parameter type is `struct bt_field_path *`. - * - * `E`: - * Trace IR event class. The parameter type is - * `struct bt_event_class *`. - * - * `e`: - * Trace IR event. The parameter type is `struct bt_event *`. - * - * `S`: - * Trace IR stream class. The parameter type is - * `struct bt_stream_class *`. - * - * `s`: - * Trace IR stream. The parameter type is `struct bt_stream *`. - * - * `a`: - * Packet. The parameter type is `struct bt_packet *`. - * - * `T`: - * Trace IR trace class. The parameter type is `struct bt_trace_class *`. - * - * `t`: - * Trace IR trace. The parameter type is `struct bt_trace *`. - * - * `K`: - * Clock class. The parameter type is `struct bt_clock_class *`. - * - * `k`: - * Clock snapshot. The parameter type is `struct bt_clock_snapshot *`. - * - * `v`: - * Value. The parameter type is `struct bt_value *`. - * - * `n`: - * Message. The parameter type is `struct bt_message *`. - * - * `i`: - * Message iterator. The parameter type is - * `struct bt_message_iterator *`. - * - * `C`: - * Component class. The parameter type is - * `struct bt_component_class *`. - * - * `c`: - * Component. The parameter type is `struct bt_component *`. - * - * `p`: - * Port. The parameter type is `struct bt_port *`. - * - * `x`: - * Connection. The parameter type is `struct bt_connection *`. - * - * `g`: - * Graph. The parameter type is `struct bt_graph *`. - * - * `l`: - * Plugin. The parameter type is `const struct bt_plugin *`. - * - * `o`: - * Object pool. The parameter type is `struct bt_object_pool *`. - * - * `O`: - * Object. The parameter type is `struct bt_object *`. - * - * Conversion specifier examples: - * - * %!f - * %![my-event-]+e - * %!t - * %!+F - * - * The string `, ` is printed between individual fields, but not after - * the last one. Therefore you must put this separator in the format - * string between two conversion specifiers, e.g.: - * - * BT_LIB_LOGW("Message: count=%u, %!E, %!+K", count, event_class, - * clock_class); - * - * Example with a custom prefix: - * - * BT_LIB_LOGI("Some message: %![ec-a-]e, %![ec-b-]+e", ec_a, ec_b); - * - * It is safe to pass NULL as any Babeltrace object parameter: the - * macros only print its null address. - */ -#define BT_LIB_LOGF(_fmt, ...) BT_LIB_LOG(BT_LOG_FATAL, _fmt, ##__VA_ARGS__) -#define BT_LIB_LOGE(_fmt, ...) BT_LIB_LOG(BT_LOG_ERROR, _fmt, ##__VA_ARGS__) -#define BT_LIB_LOGW(_fmt, ...) BT_LIB_LOG(BT_LOG_WARN, _fmt, ##__VA_ARGS__) -#define BT_LIB_LOGI(_fmt, ...) BT_LIB_LOG(BT_LOG_INFO, _fmt, ##__VA_ARGS__) -#define BT_LIB_LOGD(_fmt, ...) BT_LIB_LOG(BT_LOG_DEBUG, _fmt, ##__VA_ARGS__) -#define BT_LIB_LOGV(_fmt, ...) BT_LIB_LOG(BT_LOG_VERBOSE, _fmt, ##__VA_ARGS__) - -/* - * Log statement, specialized for the Babeltrace library. - * - * Use one of the BT_LIB_LOGF*() macros above instead of calling this - * function directly. - */ - -void bt_lib_log(const char *func, const char *file, unsigned line, - int lvl, const char *tag, const char *fmt, ...); - -#define BT_LIB_LOG_SUPPORTED - -#endif /* BABELTRACE_LIB_LOGGING_INTERNAL_H */ diff --git a/src/lib/logging.c b/src/lib/logging.c index b362d667..8c36f5ab 100644 --- a/src/lib/logging.c +++ b/src/lib/logging.c @@ -25,7 +25,7 @@ #include #define BT_LOG_TAG "LIB/LOGGING" -#include "lib/lib-logging.h" +#include "lib/logging.h" #ifdef BT_DEV_MODE /* diff --git a/src/lib/logging.h b/src/lib/logging.h new file mode 100644 index 00000000..7bb36c99 --- /dev/null +++ b/src/lib/logging.h @@ -0,0 +1,195 @@ +#ifndef BABELTRACE_LIB_LOGGING_INTERNAL_H +#define BABELTRACE_LIB_LOGGING_INTERNAL_H + +/* + * Copyright 2017-2018 Philippe Proulx + * + * 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. + */ + +#include "common/macros.h" +#include + +#ifndef BT_LOG_TAG +# error Please define a tag with BT_LOG_TAG before including this file. +#endif + +#define BT_LOG_OUTPUT_LEVEL bt_lib_log_level + +#include "logging/log.h" + +extern +int bt_lib_log_level; + +#define BT_LIB_LOG(_lvl, _fmt, ...) \ + do { \ + if (BT_LOG_ON(_lvl)) { \ + bt_lib_log(_BT_LOG_SRCLOC_FUNCTION, __FILE__, \ + __LINE__, _lvl, _BT_LOG_TAG, \ + (_fmt), ##__VA_ARGS__); \ + } \ + } while (0) + +/* + * The six macros below are logging statements which are specialized + * for the Babeltrace library. + * + * `_fmt` is a typical printf()-style format string, with the following + * limitations: + * + * * The `*` width specifier is not accepted. + * * The `*` precision specifier is not accepted. + * * The `j` and `t` length modifiers are not accepted. + * * The `n` format specifier is not accepted. + * * The format specifiers defined in are not accepted + * except for `PRId64`, `PRIu64`, `PRIx64`, `PRIX64`, `PRIo64`, and + * `PRIi64`. + * + * The Babeltrace extension conversion specifier is accepted. Its syntax + * is either `%!u` to format a UUID (`bt_uuid` type) or: + * + * 1. Introductory `%!` sequence. + * + * 2. Optional: `[` followed by a custom prefix for the printed fields + * of this specifier, followed by `]`. The standard form is to end + * this prefix with `-` so that, for example, with the prefix + * `prefix-`, the complete field name is `prefix-addr`. + * + * 3. Optional: `+` to print extended fields. This depends on the + * provided format specifier. + * + * 4. Format specifier (see below). + * + * The available format specifiers are: + * + * `F`: + * Trace IR field class. The parameter type is + * `struct bt_field_class *`. + * + * `f`: + * Trace IR field. The parameter type is `struct bt_field *`. + * + * `P`: + * Field path. The parameter type is `struct bt_field_path *`. + * + * `E`: + * Trace IR event class. The parameter type is + * `struct bt_event_class *`. + * + * `e`: + * Trace IR event. The parameter type is `struct bt_event *`. + * + * `S`: + * Trace IR stream class. The parameter type is + * `struct bt_stream_class *`. + * + * `s`: + * Trace IR stream. The parameter type is `struct bt_stream *`. + * + * `a`: + * Packet. The parameter type is `struct bt_packet *`. + * + * `T`: + * Trace IR trace class. The parameter type is `struct bt_trace_class *`. + * + * `t`: + * Trace IR trace. The parameter type is `struct bt_trace *`. + * + * `K`: + * Clock class. The parameter type is `struct bt_clock_class *`. + * + * `k`: + * Clock snapshot. The parameter type is `struct bt_clock_snapshot *`. + * + * `v`: + * Value. The parameter type is `struct bt_value *`. + * + * `n`: + * Message. The parameter type is `struct bt_message *`. + * + * `i`: + * Message iterator. The parameter type is + * `struct bt_message_iterator *`. + * + * `C`: + * Component class. The parameter type is + * `struct bt_component_class *`. + * + * `c`: + * Component. The parameter type is `struct bt_component *`. + * + * `p`: + * Port. The parameter type is `struct bt_port *`. + * + * `x`: + * Connection. The parameter type is `struct bt_connection *`. + * + * `g`: + * Graph. The parameter type is `struct bt_graph *`. + * + * `l`: + * Plugin. The parameter type is `const struct bt_plugin *`. + * + * `o`: + * Object pool. The parameter type is `struct bt_object_pool *`. + * + * `O`: + * Object. The parameter type is `struct bt_object *`. + * + * Conversion specifier examples: + * + * %!f + * %![my-event-]+e + * %!t + * %!+F + * + * The string `, ` is printed between individual fields, but not after + * the last one. Therefore you must put this separator in the format + * string between two conversion specifiers, e.g.: + * + * BT_LIB_LOGW("Message: count=%u, %!E, %!+K", count, event_class, + * clock_class); + * + * Example with a custom prefix: + * + * BT_LIB_LOGI("Some message: %![ec-a-]e, %![ec-b-]+e", ec_a, ec_b); + * + * It is safe to pass NULL as any Babeltrace object parameter: the + * macros only print its null address. + */ +#define BT_LIB_LOGF(_fmt, ...) BT_LIB_LOG(BT_LOG_FATAL, _fmt, ##__VA_ARGS__) +#define BT_LIB_LOGE(_fmt, ...) BT_LIB_LOG(BT_LOG_ERROR, _fmt, ##__VA_ARGS__) +#define BT_LIB_LOGW(_fmt, ...) BT_LIB_LOG(BT_LOG_WARN, _fmt, ##__VA_ARGS__) +#define BT_LIB_LOGI(_fmt, ...) BT_LIB_LOG(BT_LOG_INFO, _fmt, ##__VA_ARGS__) +#define BT_LIB_LOGD(_fmt, ...) BT_LIB_LOG(BT_LOG_DEBUG, _fmt, ##__VA_ARGS__) +#define BT_LIB_LOGV(_fmt, ...) BT_LIB_LOG(BT_LOG_VERBOSE, _fmt, ##__VA_ARGS__) + +/* + * Log statement, specialized for the Babeltrace library. + * + * Use one of the BT_LIB_LOGF*() macros above instead of calling this + * function directly. + */ + +void bt_lib_log(const char *func, const char *file, unsigned line, + int lvl, const char *tag, const char *fmt, ...); + +#define BT_LIB_LOG_SUPPORTED + +#endif /* BABELTRACE_LIB_LOGGING_INTERNAL_H */ diff --git a/src/lib/object-pool.c b/src/lib/object-pool.c index 3aa9b2e1..dda8b718 100644 --- a/src/lib/object-pool.c +++ b/src/lib/object-pool.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/OBJECT-POOL" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include #include "common/assert.h" diff --git a/src/lib/plugin/plugin-so.c b/src/lib/plugin/plugin-so.c index fac050dc..13cf3220 100644 --- a/src/lib/plugin/plugin-so.c +++ b/src/lib/plugin/plugin-so.c @@ -24,7 +24,7 @@ */ #define BT_LOG_TAG "LIB/PLUGIN-SO" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/plugin/plugin.c b/src/lib/plugin/plugin.c index 94594386..c0cd158a 100644 --- a/src/lib/plugin/plugin.c +++ b/src/lib/plugin/plugin.c @@ -24,7 +24,7 @@ */ #define BT_LOG_TAG "LIB/PLUGIN" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/assert.h" #include "lib/assert-pre.h" diff --git a/src/lib/plugin/plugin.h b/src/lib/plugin/plugin.h index edaad960..ed2fc4a7 100644 --- a/src/lib/plugin/plugin.h +++ b/src/lib/plugin/plugin.h @@ -37,7 +37,7 @@ /* Protection: this file uses BT_LIB_LOG*() macros directly */ #ifndef BT_LIB_LOG_SUPPORTED -# error Please include "lib/lib-logging.h" before including this file. +# error Please include "lib/logging.h" before including this file. #endif enum bt_plugin_type { diff --git a/src/lib/trace-ir/attributes.c b/src/lib/trace-ir/attributes.c index c68531c6..43f71437 100644 --- a/src/lib/trace-ir/attributes.c +++ b/src/lib/trace-ir/attributes.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/ATTRS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/macros.h" #include diff --git a/src/lib/trace-ir/clock-class.c b/src/lib/trace-ir/clock-class.c index dd78c8c9..e84a41b5 100644 --- a/src/lib/trace-ir/clock-class.c +++ b/src/lib/trace-ir/clock-class.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/CLOCK-CLASS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include "compat/uuid.h" diff --git a/src/lib/trace-ir/clock-snapshot.c b/src/lib/trace-ir/clock-snapshot.c index 6b44334e..944532a2 100644 --- a/src/lib/trace-ir/clock-snapshot.c +++ b/src/lib/trace-ir/clock-snapshot.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/CLOCK-SNAPSHOT" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include "compat/uuid.h" diff --git a/src/lib/trace-ir/event-class.c b/src/lib/trace-ir/event-class.c index 3f4f5d2d..63a250bb 100644 --- a/src/lib/trace-ir/event-class.c +++ b/src/lib/trace-ir/event-class.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/EVENT-CLASS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/event.c b/src/lib/trace-ir/event.c index 7f93d065..0053b6b7 100644 --- a/src/lib/trace-ir/event.c +++ b/src/lib/trace-ir/event.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/EVENT" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/event.h b/src/lib/trace-ir/event.h index 9cfbb56a..b2f085a0 100644 --- a/src/lib/trace-ir/event.h +++ b/src/lib/trace-ir/event.h @@ -26,7 +26,7 @@ /* Protection: this file uses BT_LIB_LOG*() macros directly */ #ifndef BT_LIB_LOG_SUPPORTED -# error Please include "lib/lib-logging.h" before including this file. +# error Please include "lib/logging.h" before including this file. #endif #include "lib/assert-pre.h" diff --git a/src/lib/trace-ir/field-class.c b/src/lib/trace-ir/field-class.c index b6a1f65d..3f658a51 100644 --- a/src/lib/trace-ir/field-class.c +++ b/src/lib/trace-ir/field-class.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/FIELD-CLASS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/field-path.c b/src/lib/trace-ir/field-path.c index 32d80552..9a4af3a2 100644 --- a/src/lib/trace-ir/field-path.c +++ b/src/lib/trace-ir/field-path.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/FIELD-PATH" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/field-wrapper.c b/src/lib/trace-ir/field-wrapper.c index 86949fe1..f1dcb679 100644 --- a/src/lib/trace-ir/field-wrapper.c +++ b/src/lib/trace-ir/field-wrapper.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/FIELD-WRAPPER" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/object-pool.h" #include "lib/object.h" diff --git a/src/lib/trace-ir/field.c b/src/lib/trace-ir/field.c index ff5c65a6..7dc4d90d 100644 --- a/src/lib/trace-ir/field.c +++ b/src/lib/trace-ir/field.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/FIELD" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/packet-context-field.c b/src/lib/trace-ir/packet-context-field.c index 612adb94..1530ef97 100644 --- a/src/lib/trace-ir/packet-context-field.c +++ b/src/lib/trace-ir/packet-context-field.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/PACKET-CONTEXT-FIELD" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/packet.c b/src/lib/trace-ir/packet.c index 6aeb2b89..a9c4ea9e 100644 --- a/src/lib/trace-ir/packet.c +++ b/src/lib/trace-ir/packet.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/PACKET" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/resolve-field-path.c b/src/lib/trace-ir/resolve-field-path.c index febcfdee..ed44e059 100644 --- a/src/lib/trace-ir/resolve-field-path.c +++ b/src/lib/trace-ir/resolve-field-path.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/RESOLVE-FIELD-PATH" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include "common/assert.h" diff --git a/src/lib/trace-ir/stream-class.c b/src/lib/trace-ir/stream-class.c index be575296..b1a528ef 100644 --- a/src/lib/trace-ir/stream-class.c +++ b/src/lib/trace-ir/stream-class.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/STREAM-CLASS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/stream.c b/src/lib/trace-ir/stream.c index a19828f4..7eb8e9cf 100644 --- a/src/lib/trace-ir/stream.c +++ b/src/lib/trace-ir/stream.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/STREAM" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/trace-class.c b/src/lib/trace-ir/trace-class.c index 28e12480..bd8ff19f 100644 --- a/src/lib/trace-ir/trace-class.c +++ b/src/lib/trace-ir/trace-class.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/TRACE" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/trace.c b/src/lib/trace-ir/trace.c index 9c5b9acf..3c030838 100644 --- a/src/lib/trace-ir/trace.c +++ b/src/lib/trace-ir/trace.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/TRACE" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/trace-ir/utils.c b/src/lib/trace-ir/utils.c index 1ba06785..06959f58 100644 --- a/src/lib/trace-ir/utils.c +++ b/src/lib/trace-ir/utils.c @@ -22,7 +22,7 @@ */ #define BT_LOG_TAG "LIB/TRACE-IR-UTILS" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include #include diff --git a/src/lib/util.c b/src/lib/util.c index 250ce8a4..3e3eb45e 100644 --- a/src/lib/util.c +++ b/src/lib/util.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/UTIL" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "lib/assert-pre.h" #include diff --git a/src/lib/value.c b/src/lib/value.c index 38ff2201..a288dc54 100644 --- a/src/lib/value.c +++ b/src/lib/value.c @@ -21,7 +21,7 @@ */ #define BT_LOG_TAG "LIB/VALUE" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include #include diff --git a/src/python-plugin-provider/python-plugin-provider.c b/src/python-plugin-provider/python-plugin-provider.c index 88c04e84..6f775cb0 100644 --- a/src/python-plugin-provider/python-plugin-provider.c +++ b/src/python-plugin-provider/python-plugin-provider.c @@ -26,7 +26,7 @@ #define BT_LOG_TAG "LIB/PLUGIN-PY" -#include "lib/lib-logging.h" +#include "lib/logging.h" #include "common/macros.h" #include "compat/compiler.h" #include