2 * Copyright (C) 2013 Stefan Sauer <ensonic@users.sf.net>
4 * gstlog.c: tracing module that logs events
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
28 GST_DEBUG_CATEGORY_STATIC (gst_log_debug);
29 #define GST_CAT_DEFAULT gst_log_debug
32 GST_DEBUG_CATEGORY_INIT (gst_log_debug, "log", 0, "log tracer");
33 #define gst_log_tracer_parent_class parent_class
34 G_DEFINE_TYPE_WITH_CODE (GstLogTracer, gst_log_tracer, GST_TYPE_TRACER,
37 static void gst_log_tracer_invoke (GstTracer * self, GstTracerHookId id,
41 gst_log_tracer_class_init (GstLogTracerClass * klass)
43 GstTracerClass *gst_tracer_class = GST_TRACER_CLASS (klass);
45 gst_tracer_class->invoke = gst_log_tracer_invoke;
49 gst_log_tracer_init (GstLogTracer * self)
51 g_object_set (self, "mask", GST_TRACER_HOOK_ALL, NULL);
55 gst_log_tracer_invoke (GstTracer * self, GstTracerHookId id, GstStructure * s)
57 gchar *str = gst_structure_to_string (s);
58 /* TODO(ensonic): log to different categories depending on 'id'
59 * GST_TRACER_HOOK_ID_BUFFERS -> GST_CAT_BUFFER
60 * GST_TRACER_HOOK_ID_EVENTS -> GST_CAT_EVENT
61 * GST_TRACER_HOOK_ID_MESSAGES -> GST_CAT_MESSAGE
62 * GST_TRACER_HOOK_ID_QUERIES -> ?
63 * GST_TRACER_HOOK_ID_TOPLOGY -> ?
65 GST_TRACE ("%s", str);