Split CTF IR and CTF writer APIs and implementations
[babeltrace.git] / include / babeltrace / lib-logging-internal.h
index 4f4f04348c0b13a0256a8f85b8873c572666bf00..376be0bc88535e0495eb7832246c627cde17686d 100644 (file)
 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,137 @@ int bt_lib_log_level;
  * 3. Optional: `+` to print extended fields. This depends on the
  *    provided format specifier.
  *
- * 4. Format specifier.
+ * 4. Objet category: `w` for CTF writer objects, `_` for common
+ *    objects, or nothing for default objects (includes CTF IR).
+ *
+ * 5. Format specifier (see below).
  *
  * The available format specifiers are:
  *
- * `r`:
- *     Reference count information. The parameter is any Babeltrace
- *     object.
+ * Default category:
+ *   `r`:
+ *       Reference count information. The parameter is any Babeltrace
+ *       object.
+ *
+ *   `F`:
+ *       CTF IR field type. The parameter type is `struct bt_field_type *`.
+ *
+ *   `f`:
+ *       CTF IR field. The parameter type is `struct bt_field *`.
+ *
+ *   `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`:
+ *       CTF IR event. The parameter type is `struct bt_event *`.
+ *
+ *   `S`:
+ *       CTF IR stream class. The parameter type is `struct bt_stream_class *`.
+ *
+ *   `s`:
+ *       CTF IR stream. The parameter type is `struct bt_stream *`.
+ *
+ *   `a`:
+ *       Packet. The parameter type is `struct bt_packet *`.
  *
- * `F`:
- *     Field type. The parameter type is `struct bt_field_type *`.
+ *   `t`:
+ *       CTF IR trace. The parameter type is `struct bt_trace *`.
  *
- * `f`:
- *     Field. The parameter type is `struct bt_field *`.
+ *   `K`:
+ *       Clock class. The parameter type is `struct bt_clock_class *`.
  *
- * `P`:
- *     Field path. The parameter type is `struct bt_field_path *`.
+ *   `k`:
+ *       Clock value. The parameter type is `struct bt_clock_value *`.
  *
- * `E`:
- *     Event class. The parameter type is `struct bt_event_class *`.
+ *   `v`:
+ *       Value. The parameter type is `struct bt_value *`.
  *
- * `e`:
- *     Event. The parameter type is `struct bt_event *`.
+ *   `n`:
+ *       Notification. The parameter type is `struct bt_notification *`.
  *
- * `S`:
- *     Stream class. The parameter type is `struct bt_stream_class *`.
+ *   `i`:
+ *       Notification iterator. The parameter type is
+ *       `struct bt_notification_iterator *`.
  *
- * `s`:
- *     Stream. The parameter type is `struct bt_stream *`.
+ *   `C`:
+ *       Component class. The parameter type is `struct bt_component_class *`.
  *
- * `a`:
- *     Packet. The parameter type is `struct bt_packet *`.
+ *   `c`:
+ *       Component. The parameter type is `struct bt_component *`.
  *
- * `t`:
- *     Trace. The parameter type is `struct bt_trace *`.
+ *   `p`:
+ *       Port. The parameter type is `struct bt_port *`.
  *
- * `K`:
- *     Clock class. The parameter type is `struct bt_clock_class *`.
+ *   `x`:
+ *       Connection. The parameter type is `struct bt_connection *`.
  *
- * `k`:
- *     Clock value. The parameter type is `struct bt_clock_value *`.
+ *   `g`:
+ *       Graph. The parameter type is `struct bt_graph *`.
  *
- * `v`:
- *     Value. The parameter type is `struct bt_value *`.
+ *   `u`:
+ *       Plugin. The parameter type is `struct bt_plugin *`.
  *
- * `n`:
- *     Notification. The parameter type is `struct bt_notification *`.
+ * CTF writer category:
+ *   `F`:
+ *       CTF writer field type. The parameter type is `struct bt_field_type *`.
  *
- * `i`:
- *     Notification iterator. The parameter type is
- *     `struct bt_notification_iterator *`.
+ *   `f`:
+ *       CTF writer field. The parameter type is `struct bt_field *`.
  *
- * `C`:
- *     Component class. The parameter type is `struct bt_component_class *`.
+ *   `E`:
+ *       CTF writer event class. The parameter type is
+ *       `struct bt_event_class *`.
  *
- * `c`:
- *     Component. The parameter type is `struct bt_component *`.
+ *   `e`:
+ *       CTF writer event. The parameter type is `struct bt_event *`.
  *
- * `p`:
- *     Port. The parameter type is `struct bt_port *`.
+ *   `S`:
+ *       CTF writer stream class. The parameter type is
+ *       `struct bt_stream_class *`.
  *
- * `x`:
- *     Connection. The parameter type is `struct bt_connection *`.
+ *   `s`:
+ *       CTF writer stream. The parameter type is `struct bt_stream *`.
  *
- * `g`:
- *     Graph. The parameter type is `struct bt_graph *`.
+ *   `t`:
+ *       CTF writer trace. The parameter type is `struct bt_trace *`.
  *
- * `u`:
- *     Plugin. The parameter type is `struct bt_plugin *`.
+ *   `w`:
+ *       CTF writer. The parameter type is `struct bt_ctf_writer *`.
  *
- * `w`:
- *     CTF writer. The parameter type is `struct bt_ctf_writer *`.
+ * Common category:
+ *   `F`:
+ *       Common field type. The parameter type is `struct bt_field_type *`.
+ *
+ *   `f`:
+ *       Common field. The parameter type is `struct bt_field *`.
+ *
+ *   `E`:
+ *       Common event class. The parameter type is
+ *       `struct bt_event_class *`.
+ *
+ *   `e`:
+ *       Common event. The parameter type is `struct bt_event *`.
+ *
+ *   `S`:
+ *       Common stream class. The parameter type is
+ *       `struct bt_stream_class *`.
+ *
+ *   `s`:
+ *       Common stream. The parameter type is `struct bt_stream *`.
+ *
+ *   `t`:
+ *       Common trace. The parameter type is `struct bt_trace *`.
+ *
+ * Conversion specifier examples:
+ *
+ *     %!f
+ *     %![my-event-]+e
+ *     %!_t
+ *     %![ctf-writer-ec-]wE
+ *     %!+_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 +216,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__)
This page took 0.025997 seconds and 4 git commands to generate.