info: rename new log macros from GST_*_OBJECT_ID -> GST_*_ID
[platform/upstream/gstreamer.git] / subprojects / gstreamer / gst / gstinfo.h
index 9d8d7f9..416bd7c 100644 (file)
@@ -368,11 +368,48 @@ void            gst_debug_log_valist     (GstDebugCategory * category,
                                           GstDebugLevel      level,
                                           const gchar      * file,
                                           const gchar      * function,
-                                          gint               line,
+                                          gint              line,
                                           GObject          * object,
                                           const gchar      * format,
                                           va_list            args) G_GNUC_NO_INSTRUMENT;
 
+GST_API
+void            gst_debug_log_literal    (GstDebugCategory * category,
+                                          GstDebugLevel      level,
+                                          const gchar      * file,
+                                          const gchar      * function,
+                                          gint              line,
+                                          GObject          * object,
+                                          const gchar      * message_string) G_GNUC_NO_INSTRUMENT;
+
+GST_API
+void           gst_debug_log_id          (GstDebugCategory * category,
+                                          GstDebugLevel      level,
+                                          const gchar      * file,
+                                          const gchar      * function,
+                                          gint               line,
+                                         const gchar      * id,
+                                          const gchar      * format,
+                                          ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT;
+GST_API
+void            gst_debug_log_id_valist  (GstDebugCategory * category,
+                                          GstDebugLevel      level,
+                                          const gchar      * file,
+                                          const gchar      * function,
+                                          gint              line,
+                                          const gchar      * id,
+                                          const gchar      * format,
+                                          va_list            args) G_GNUC_NO_INSTRUMENT;
+
+GST_API
+void            gst_debug_log_id_literal (GstDebugCategory * category,
+                                          GstDebugLevel      level,
+                                          const gchar      * file,
+                                          const gchar      * function,
+                                          gint              line,
+                                          const gchar      * id,
+                                          const gchar      * message_string) G_GNUC_NO_INSTRUMENT;
+
 /* do not use this function, use the GST_DEBUG_CATEGORY_INIT macro */
 
 GST_API
@@ -386,13 +423,18 @@ GST_API
 GstDebugCategory *_gst_debug_get_category (const gchar *name);
 
 
-/* do not use this function, use the GST_CAT_MEMDUMP_* macros */
+/* do not use these functions, use the GST_CAT_MEMDUMP_* macros */
 
 GST_API
 void _gst_debug_dump_mem (GstDebugCategory * cat, const gchar * file,
     const gchar * func, gint line, GObject * obj, const gchar * msg,
     const guint8 * data, guint length);
 
+GST_API
+void _gst_debug_dump_mem_id (GstDebugCategory * cat, const gchar * file,
+    const gchar * func, gint line, const gchar *object_id, const gchar * msg,
+    const guint8 * data, guint length);
+
 /**
  * GstDebugFuncPtr: (attributes doc.skip=true)
  * we define this to avoid a compiler warning regarding a cast from a function
@@ -415,6 +457,9 @@ GST_API
 const gchar   * gst_debug_message_get    (GstDebugMessage  * message);
 
 GST_API
+const gchar   * gst_debug_message_get_id (GstDebugMessage  * message);
+
+GST_API
 gchar         * gst_debug_log_get_line    (GstDebugCategory * category,
                                            GstDebugLevel      level,
                                            const gchar      * file,
@@ -714,6 +759,62 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
 #endif
 #endif /* G_HAVE_ISO_VARARGS */
 
+/**
+ * GST_CAT_LEVEL_LOG_ID:
+ * @cat: category to use
+ * @level: the severity of the message
+ * @id: (transfer none) (allow-none): the identifier of the object this message
+ *     relates to, or %NULL if none
+ * @...: A printf-style message to output
+ *
+ * Outputs a debugging message. This is the most general macro for outputting
+ * debugging messages. You will probably want to use one of the ones described
+ * below.
+ *
+ * There is no need to finish the end of the debug message with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+#ifdef G_HAVE_ISO_VARARGS
+#define GST_CAT_LEVEL_LOG_ID(cat,level,id,...) G_STMT_START{           \
+  if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) {                                            \
+    gst_debug_log_id ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,        \
+                     (id), __VA_ARGS__);                               \
+  }                                                                    \
+}G_STMT_END
+#else /* G_HAVE_GNUC_VARARGS */
+#ifdef G_HAVE_GNUC_VARARGS
+#define GST_CAT_LEVEL_LOG_ID(cat,level,id,args...) G_STMT_START{       \
+  if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) {                                            \
+    gst_debug_log_id ((cat), (level), __FILE__, GST_FUNCTION, __LINE__,        \
+                     (id), ##args );                                   \
+  }                                                                    \
+}G_STMT_END
+#else /* no variadic macros, use inline */
+static inline void
+GST_CAT_LEVEL_LOG_ID_valist (GstDebugCategory * cat,
+    GstDebugLevel level, const gchar *id, const char *format, va_list varargs)
+{
+  if (G_UNLIKELY ((level) <= GST_LEVEL_MAX && (level) <= _gst_debug_min)) {
+    gst_debug_log_id_valist (cat, level, "", "", 0, id, format,
+        varargs);
+  }
+}
+
+static inline void
+GST_CAT_LEVEL_LOG_ID (GstDebugCategory * cat, GstDebugLevel level,
+    const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (cat, level, id, format, varargs);
+  va_end (varargs);
+}
+#endif
+#endif /* G_HAVE_ISO_VARARGS */
+
 /* This one doesn't have varargs in the macro, so it's different than all the
  * other macros and hence in a separate block right here. Docs chunks are
  * with the other doc chunks below though. */
@@ -725,12 +826,35 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
   }                                                                           \
 }G_STMT_END
 
+/**
+ * __GST_CAT_MEMDUMP_LOG_ID:
+ *
+ * Only for private usage
+ *
+ * This one doesn't have varargs in the macro, so it's different than all the
+ * other macros and hence in a separate block right here. Docs chunks are
+ * with the other doc chunks below though.
+ *
+ * Since: 1.22
+ */
+#define __GST_CAT_MEMDUMP_LOG_ID(cat,id,msg,data,length) G_STMT_START{ \
+    if (G_UNLIKELY (GST_LEVEL_MEMDUMP <= GST_LEVEL_MAX &&              \
+                   GST_LEVEL_MEMDUMP <= _gst_debug_min)) {             \
+      _gst_debug_dump_mem_id ((cat), __FILE__, GST_FUNCTION, __LINE__, \
+                             (id), (msg), (data), (length));           \
+    }                                                                  \
+}G_STMT_END
+
 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length)  \
     __GST_CAT_MEMDUMP_LOG(cat,obj,msg,data,length)
+#define GST_CAT_MEMDUMP_ID(cat,id,msg,data,length)     \
+    __GST_CAT_MEMDUMP_LOG_ID(cat,id,msg,data,length)
 #define GST_CAT_MEMDUMP(cat,msg,data,length)             \
     __GST_CAT_MEMDUMP_LOG(cat,NULL,msg,data,length)
 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)          \
     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,obj,msg,data,length)
+#define GST_MEMDUMP_ID(id,msg,data,length)          \
+    __GST_CAT_MEMDUMP_LOG_ID(GST_CAT_DEFAULT,id,msg,data,length)
 #define GST_MEMDUMP(msg,data,length)                     \
     __GST_CAT_MEMDUMP_LOG(GST_CAT_DEFAULT,NULL,msg,data,length)
 
@@ -828,6 +952,22 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
  * character, a newline character will be added automatically.
  */
 
+/**
+ * GST_CAT_MEMDUMP_ID:
+ * @cat: category to use
+ * @id: An identifier of the message provider
+ * @msg: message string to log with the data
+ * @data: pointer to the data to output
+ * @length: length of the data to output
+ *
+ * Output a hexdump of @data relating to the given @id in the given category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+
 
 /**
  * GST_CAT_ERROR:
@@ -998,6 +1138,107 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
  * character, a newline character will be added automatically.
  */
 
+/**
+ * GST_ERROR_ID:
+ * @id: An identifier of the message provider
+ * @...: printf-style message to output
+ *
+ * Output an error message for the given identifier in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+/**
+ * GST_WARNING_ID:
+ * @id: An identifier of the message provider
+ * @...: printf-style message to output
+ *
+ * Output a warning message for the given identifier in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+/**
+ * GST_INFO_ID:
+ * @id: An identifier of the message provider
+ * @...: printf-style message to output
+ *
+ * Output an informational message for the given identifier the default
+ * category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+/**
+ * GST_DEBUG_ID:
+ * @id: An identifier of the message provider
+ * @...: printf-style message to output
+ *
+ * Output a debugging message for the given identifier in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+/**
+ * GST_LOG_ID:
+ * @id: An identifier of the message provider
+ * @...: printf-style message to output
+ *
+ * Output a logging message for the given identifier in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+/**
+ * GST_FIXME_ID:
+ * @id: An identifier of the message provider
+ * @...: printf-style message to output
+ *
+ * Output a fixme message for the given identifier in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+/**
+ * GST_TRACE_ID:
+ * @id: An identifier of the message provider
+ * @...: printf-style message to output
+ *
+ * Output a tracing message for the given identifier  in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+/**
+ * GST_MEMDUMP_ID:
+ * @id: An identifier of the message provider
+ * @msg: message string to log with the data
+ * @data: pointer to the data to output
+ * @length: length of the data to output
+ *
+ * Output a logging message belonging to the given object in the default category.
+ *
+ * There is no need to finish the end of the message string with a newline
+ * character, a newline character will be added automatically.
+ *
+ * Since: 1.22
+ */
+
+
 
 /**
  * GST_ERROR:
@@ -1100,6 +1341,14 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
 #define GST_FIXME_OBJECT(obj,...)      GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  __VA_ARGS__)
 #define GST_TRACE_OBJECT(obj,...)      GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  __VA_ARGS__)
 
+#define GST_ERROR_ID(id,...)   GST_CAT_LEVEL_LOG_ID (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   id,  __VA_ARGS__)
+#define GST_WARNING_ID(id,...) GST_CAT_LEVEL_LOG_ID (GST_CAT_DEFAULT, GST_LEVEL_WARNING, id,  __VA_ARGS__)
+#define GST_INFO_ID(id,...)    GST_CAT_LEVEL_LOG_ID (GST_CAT_DEFAULT, GST_LEVEL_INFO,    id,  __VA_ARGS__)
+#define GST_DEBUG_ID(id,...)   GST_CAT_LEVEL_LOG_ID (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   id,  __VA_ARGS__)
+#define GST_LOG_ID(id,...)     GST_CAT_LEVEL_LOG_ID (GST_CAT_DEFAULT, GST_LEVEL_LOG,     id,  __VA_ARGS__)
+#define GST_FIXME_ID(id,...)   GST_CAT_LEVEL_LOG_ID (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   id,  __VA_ARGS__)
+#define GST_TRACE_ID(id,...)   GST_CAT_LEVEL_LOG_ID (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   id,  __VA_ARGS__)
+
 #define GST_ERROR(...)                 GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, __VA_ARGS__)
 #define GST_WARNING(...)               GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, __VA_ARGS__)
 #define GST_INFO(...)                  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, __VA_ARGS__)
@@ -1135,6 +1384,14 @@ GST_CAT_LEVEL_LOG (GstDebugCategory * cat, GstDebugLevel level,
 #define GST_FIXME_OBJECT(obj,args...)  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   obj,  ##args )
 #define GST_TRACE_OBJECT(obj,args...)  GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   obj,  ##args )
 
+#define GST_ERROR_ID(id,args...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   id,  ##args )
+#define GST_WARNING_ID(id,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, id,  ##args )
+#define GST_INFO_ID(id,args...)        GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    id,  ##args )
+#define GST_DEBUG_ID(id,args...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_DEBUG,   id,  ##args )
+#define GST_LOG_ID(id,args...) GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_LOG,     id,  ##args )
+#define GST_FIXME_ID(id,args...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_FIXME,   id,  ##args )
+#define GST_TRACE_ID(id,args...)       GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_TRACE,   id,  ##args )
+
 #define GST_ERROR(args...)             GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_ERROR,   NULL, ##args )
 #define GST_WARNING(args...)           GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_WARNING, NULL, ##args )
 #define GST_INFO(args...)              GST_CAT_LEVEL_LOG (GST_CAT_DEFAULT, GST_LEVEL_INFO,    NULL, ##args )
@@ -1370,6 +1627,83 @@ GST_TRACE_OBJECT (gpointer obj, const char *format, ...)
 }
 
 static inline void
+GST_ERROR_ID (const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (GST_CAT_DEFAULT, GST_LEVEL_ERROR, id, format,
+      varargs);
+  va_end (varargs);
+}
+
+static inline void
+GST_WARNING_ID (const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (GST_CAT_DEFAULT, GST_LEVEL_WARNING, id, format,
+      varargs);
+  va_end (varargs);
+}
+
+static inline void
+GST_INFO_ID (const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (GST_CAT_DEFAULT, GST_LEVEL_INFO, id, format,
+      varargs);
+  va_end (varargs);
+}
+
+static inline void
+GST_DEBUG_ID (const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (GST_CAT_DEFAULT, GST_LEVEL_DEBUG, id, format,
+      varargs);
+  va_end (varargs);
+}
+
+static inline void
+GST_LOG_ID (const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (GST_CAT_DEFAULT, GST_LEVEL_LOG, id, format,
+      varargs);
+  va_end (varargs);
+}
+
+static inline void
+GST_FIXME_ID (const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (GST_CAT_DEFAULT, GST_LEVEL_FIXME, id, format,
+      varargs);
+  va_end (varargs);
+}
+
+static inline void
+GST_TRACE_ID (const gchar *id, const char *format, ...)
+{
+  va_list varargs;
+
+  va_start (varargs, format);
+  GST_CAT_LEVEL_LOG_ID_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, id, format,
+      varargs);
+  va_end (varargs);
+}
+
+static inline void
 GST_ERROR (const char *format, ...)
 {
   va_list varargs;
@@ -1496,6 +1830,10 @@ GST_TRACE (const char *format, ...)
 #if defined(__GNUC__) && __GNUC__ >= 3
 #  pragma GCC poison gst_debug_log
 #  pragma GCC poison gst_debug_log_valist
+#  pragma GCC poison gst_debug_log_literal
+#  pragma GCC poison gst_debug_log_id
+#  pragma GCC poison gst_debug_log_id_valist
+#  pragma GCC poison gst_debug_log_id_literal
 #  pragma GCC poison _gst_debug_category_new
 #endif
 
@@ -1506,6 +1844,7 @@ GST_TRACE (const char *format, ...)
 
 #define gst_debug_level_get_name(level)                                ("NONE")
 #define gst_debug_message_get(message)                         ("")
+#define gst_debug_message_get_id(message)                      (NULL)
 #define gst_debug_add_log_function(func,data,notify)    G_STMT_START{ }G_STMT_END
 #define gst_debug_set_active(active)                   G_STMT_START{ }G_STMT_END
 #define gst_debug_is_active()                          (FALSE)
@@ -1570,6 +1909,14 @@ GST_TRACE (const char *format, ...)
 #define GST_FIXME_OBJECT(...)                          G_STMT_START{ }G_STMT_END
 #define GST_TRACE_OBJECT(...)                          G_STMT_START{ }G_STMT_END
 
+#define GST_ERROR_ID(...)                      G_STMT_START{ }G_STMT_END
+#define GST_WARNING_ID(...)                    G_STMT_START{ }G_STMT_END
+#define GST_INFO_ID(...)                               G_STMT_START{ }G_STMT_END
+#define GST_DEBUG_ID(...)                      G_STMT_START{ }G_STMT_END
+#define GST_LOG_ID(...)                                G_STMT_START{ }G_STMT_END
+#define GST_FIXME_ID(...)                      G_STMT_START{ }G_STMT_END
+#define GST_TRACE_ID(...)                      G_STMT_START{ }G_STMT_END
+
 #define GST_ERROR(...)                                 G_STMT_START{ }G_STMT_END
 #define GST_WARNING(...)                               G_STMT_START{ }G_STMT_END
 #define GST_INFO(...)                                  G_STMT_START{ }G_STMT_END
@@ -1607,6 +1954,14 @@ GST_TRACE (const char *format, ...)
 #define GST_FIXME_OBJECT(args...)                      G_STMT_START{ }G_STMT_END
 #define GST_TRACE_OBJECT(args...)                      G_STMT_START{ }G_STMT_END
 
+#define GST_ERROR_ID(args...)                  G_STMT_START{ }G_STMT_END
+#define GST_WARNING_ID(args...)                        G_STMT_START{ }G_STMT_END
+#define GST_INFO_ID(args...)                   G_STMT_START{ }G_STMT_END
+#define GST_DEBUG_ID(args...)                  G_STMT_START{ }G_STMT_END
+#define GST_LOG_ID(args...)                    G_STMT_START{ }G_STMT_END
+#define GST_FIXME_ID(args...)                  G_STMT_START{ }G_STMT_END
+#define GST_TRACE_ID(args...)                  G_STMT_START{ }G_STMT_END
+
 #define GST_ERROR(args...)                             G_STMT_START{ }G_STMT_END
 #define GST_WARNING(args...)                           G_STMT_START{ }G_STMT_END
 #define GST_INFO(args...)                              G_STMT_START{ }G_STMT_END
@@ -1777,8 +2132,10 @@ GST_TRACE (const char *format, ...)
 #define GST_DEBUG_FUNCPTR_NAME(ptr) (g_strdup_printf ("%p", ptr))
 
 #define GST_CAT_MEMDUMP_OBJECT(cat,obj,msg,data,length) G_STMT_START{ }G_STMT_END
+#define GST_CAT_MEMDUMP_ID(cat,id,msg,data,length)      G_STMT_START{ }G_STMT_END
 #define GST_CAT_MEMDUMP(cat,msg,data,length)            G_STMT_START{ }G_STMT_END
 #define GST_MEMDUMP_OBJECT(obj,msg,data,length)         G_STMT_START{ }G_STMT_END
+#define GST_MEMDUMP_ID(id,msg,data,length)              G_STMT_START{ }G_STMT_END
 #define GST_MEMDUMP(msg,data,length)                    G_STMT_START{ }G_STMT_END
 
 #endif /* GST_DISABLE_GST_DEBUG */