]> git.0d.be Git - empathy.git/blob - libempathy/empathy-debugger.h
Merge branch 'debugger'
[empathy.git] / libempathy / empathy-debugger.h
1 /*
2  * header for Telepathy debug interface implementation
3  * Copyright (C) 2009 Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19
20 #ifndef _EMPATHY_DEBUGGER
21 #define _EMPATHY_DEBUGGER
22
23 #include <glib-object.h>
24
25 #include <telepathy-glib/properties-mixin.h>
26 #include <telepathy-glib/dbus-properties-mixin.h>
27
28 #include "extensions/extensions.h"
29
30 G_BEGIN_DECLS
31
32 #define EMPATHY_TYPE_DEBUGGER empathy_debugger_get_type()
33
34 #define EMPATHY_DEBUGGER(obj) \
35   (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_DEBUGGER, EmpathyDebugger))
36
37 #define EMPATHY_DEBUGGER_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST ((klass), EMPATHY_TYPE_DEBUGGER, EmpathyDebuggerClass))
39
40 #define EMPATHY_IS_DEBUGGER(obj) \
41   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_DEBUGGER))
42
43 #define EMPATHY_IS_DEBUGGER_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_TYPE ((klass), EMPATHY_TYPE_DEBUGGER))
45
46 #define EMPATHY_DEBUGGER_GET_CLASS(obj) \
47   (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_DEBUGGER, EmpathyDebuggerClass))
48
49 /* On the basis that messages are around 60 bytes on average, and that 50kb is
50  * a reasonable maximum size for a frame buffer.
51  */
52
53 #define DEBUG_MESSAGE_LIMIT 800
54
55 typedef struct {
56   gdouble timestamp;
57   gchar *domain;
58   EmpDebugLevel level;
59   gchar *string;
60 } EmpathyDebugMessage;
61
62 typedef struct {
63   GObject parent;
64
65   gboolean enabled;
66   GQueue *messages;
67 } EmpathyDebugger;
68
69 typedef struct {
70   GObjectClass parent_class;
71   TpDBusPropertiesMixinClass dbus_props_class;
72 } EmpathyDebuggerClass;
73
74 GType empathy_debugger_get_type (void);
75
76 EmpathyDebugger *
77 empathy_debugger_get_singleton (void);
78
79 void
80 empathy_debugger_add_message (EmpathyDebugger *self,
81     GTimeVal *timestamp,
82     const gchar *domain,
83     GLogLevelFlags level,
84     const gchar *string);
85
86 G_END_DECLS
87
88 #endif /* _EMPATHY_DEBUGGER */