X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Flib-logging-internal.h;h=4373312787e89298b37a1daac096f6b89d4111cf;hb=cb6f1f7dfb7938a4738a7f3ca3886334fbceb1a3;hp=4f4f04348c0b13a0256a8f85b8873c572666bf00;hpb=476ef9815a2852d362ebc3b090f9535eb0227189;p=babeltrace.git diff --git a/include/babeltrace/lib-logging-internal.h b/include/babeltrace/lib-logging-internal.h index 4f4f0434..43733127 100644 --- a/include/babeltrace/lib-logging-internal.h +++ b/include/babeltrace/lib-logging-internal.h @@ -33,6 +33,15 @@ 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. @@ -61,77 +70,84 @@ int bt_lib_log_level; * 3. Optional: `+` to print extended fields. This depends on the * provided format specifier. * - * 4. Format specifier. + * 4. Format specifier (see below). * * The available format specifiers are: * - * `r`: - * Reference count information. The parameter is any Babeltrace - * object. + * `r`: + * Reference count information. The parameter is any Babeltrace + * object. + * + * `F`: + * CTF IR field type. The parameter type is `struct bt_field_type *`. * - * `F`: - * Field type. The parameter type is `struct bt_field_type *`. + * `f`: + * CTF IR field. The parameter type is `struct bt_field *`. * - * `f`: - * Field. The parameter type is `struct bt_field *`. + * `P`: + * Field path. The parameter type is `struct bt_field_path *`. * - * `P`: - * Field path. The parameter type is `struct bt_field_path *`. + * `E`: + * CTF IR event class. The parameter type is `struct bt_event_class *`. * - * `E`: - * Event class. The parameter type is `struct bt_event_class *`. + * `e`: + * CTF IR event. The parameter type is `struct bt_event *`. * - * `e`: - * Event. The parameter type is `struct bt_event *`. + * `S`: + * CTF IR stream class. The parameter type is `struct bt_stream_class *`. * - * `S`: - * Stream class. The parameter type is `struct bt_stream_class *`. + * `s`: + * CTF IR stream. The parameter type is `struct bt_stream *`. * - * `s`: - * Stream. The parameter type is `struct bt_stream *`. + * `a`: + * Packet. The parameter type is `struct bt_packet *`. * - * `a`: - * Packet. The parameter type is `struct bt_packet *`. + * `t`: + * CTF IR trace. The parameter type is `struct bt_trace *`. * - * `t`: - * Trace. The parameter type is `struct bt_trace *`. + * `K`: + * Clock class. The parameter type is `struct bt_clock_class *`. * - * `K`: - * Clock class. The parameter type is `struct bt_clock_class *`. + * `k`: + * Clock value. The parameter type is `struct bt_clock_value *`. * - * `k`: - * Clock value. The parameter type is `struct bt_clock_value *`. + * `v`: + * Value. The parameter type is `struct bt_value *`. * - * `v`: - * Value. The parameter type is `struct bt_value *`. + * `n`: + * Notification. The parameter type is `struct bt_notification *`. * - * `n`: - * Notification. The parameter type is `struct bt_notification *`. + * `i`: + * Notification iterator. The parameter type is + * `struct bt_notification_iterator *`. * - * `i`: - * Notification iterator. The parameter type is - * `struct bt_notification_iterator *`. + * `C`: + * Component class. The parameter type is `struct bt_component_class *`. * - * `C`: - * Component class. The parameter type is `struct bt_component_class *`. + * `c`: + * Component. The parameter type is `struct bt_component *`. * - * `c`: - * Component. The parameter type is `struct bt_component *`. + * `p`: + * Port. The parameter type is `struct bt_port *`. * - * `p`: - * Port. The parameter type is `struct bt_port *`. + * `x`: + * Connection. The parameter type is `struct bt_connection *`. * - * `x`: - * Connection. The parameter type is `struct bt_connection *`. + * `g`: + * Graph. The parameter type is `struct bt_graph *`. * - * `g`: - * Graph. The parameter type is `struct bt_graph *`. + * `u`: + * Plugin. The parameter type is `struct bt_plugin *`. * - * `u`: - * Plugin. The parameter type is `struct bt_plugin *`. + * `o`: + * Object pool. The parameter type is `struct bt_object_pool *`. * - * `w`: - * CTF writer. The parameter type is `struct bt_ctf_writer *`. + * 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 @@ -147,15 +163,6 @@ int bt_lib_log_level; * It is safe to pass NULL as any Babeltrace object parameter: the * macros only print its null address. */ -#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) - #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__)