diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-03-18 17:23:48 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-03-19 17:30:33 +0000 |
commit | cb955db4e0affefd427280b5d18bb3b2914eeff3 (patch) | |
tree | 89699141e403e44433960e5ea56762090036e08a | |
parent | c51f2ee53f2743b9363fe9b8f9a293e0cea97dc3 (diff) | |
download | telepathy-glib-cb955db4e0affefd427280b5d18bb3b2914eeff3.tar.gz |
tpl_debug_set_flags: add
Public API to set debug flags, from EMPATHY_DEBUG or similar,
seems a good thing to have.
Reviewed-by: Xavier Claessens
-rw-r--r-- | telepathy-logger/Makefile.am | 1 | ||||
-rw-r--r-- | telepathy-logger/debug-internal.h | 6 | ||||
-rw-r--r-- | telepathy-logger/debug.c | 12 | ||||
-rw-r--r-- | telepathy-logger/debug.h | 32 | ||||
-rw-r--r-- | telepathy-logger/telepathy-logger.h | 1 |
5 files changed, 44 insertions, 8 deletions
diff --git a/telepathy-logger/Makefile.am b/telepathy-logger/Makefile.am index 456207400..ad4f88138 100644 --- a/telepathy-logger/Makefile.am +++ b/telepathy-logger/Makefile.am @@ -49,6 +49,7 @@ EXTRA_DIST = \ LIBTPLdir = $(includedir)/telepathy-logger-1/telepathy-logger LIBTPL_HEADERS = \ + debug.h \ entity.h \ event.h \ log-manager.h \ diff --git a/telepathy-logger/debug-internal.h b/telepathy-logger/debug-internal.h index 66e6178ea..e99522bec 100644 --- a/telepathy-logger/debug-internal.h +++ b/telepathy-logger/debug-internal.h @@ -18,8 +18,8 @@ * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> */ -#ifndef __TPL_DEBUG_H__ -#define __TPL_DEBUG_H__ +#ifndef __TPL_DEBUG_INTERNAL_H__ +#define __TPL_DEBUG_INTERNAL_H__ #include "config.h" @@ -95,4 +95,4 @@ G_STMT_START { \ #endif /* DEBUG_FLAG */ -#endif /* __TPL_DEBUG_H__ */ +#endif /* __TPL_DEBUG_INTERNAL_H__ */ diff --git a/telepathy-logger/debug.c b/telepathy-logger/debug.c index cd59a1286..de9f44f37 100644 --- a/telepathy-logger/debug.c +++ b/telepathy-logger/debug.c @@ -19,6 +19,7 @@ */ #include "config.h" +#include "telepathy-logger/debug.h" #include "telepathy-logger/debug-internal.h" #include <telepathy-glib/telepathy-glib.h> @@ -41,22 +42,23 @@ static GDebugKey keys[] = { }; void -_tpl_debug_set_flags_from_env (void) +tpl_debug_set_flags (const gchar *flags_string) { guint nkeys; - const gchar *flags_string; for (nkeys = 0; keys[nkeys].value; nkeys++); - flags_string = g_getenv ("TPL_DEBUG"); - if (flags_string != NULL) _tpl_debug_set_flags (g_parse_debug_string (flags_string, keys, nkeys)); +} +void +_tpl_debug_set_flags_from_env (void) +{ + tpl_debug_set_flags (g_getenv ("TPL_DEBUG")); tp_debug_set_flags (g_getenv ("TP_DEBUG")); } - void _tpl_debug_set_flags (TplDebugFlags new_flags) { diff --git a/telepathy-logger/debug.h b/telepathy-logger/debug.h new file mode 100644 index 000000000..641abeb7d --- /dev/null +++ b/telepathy-logger/debug.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> + */ + +#ifndef __TPL_DEBUG_H__ +#define __TPL_DEBUG_H__ + +#include <glib.h> + +G_BEGIN_DECLS + +void tpl_debug_set_flags (const gchar *flags_string); + +G_END_DECLS + +#endif diff --git a/telepathy-logger/telepathy-logger.h b/telepathy-logger/telepathy-logger.h index 54d42d848..10578de0e 100644 --- a/telepathy-logger/telepathy-logger.h +++ b/telepathy-logger/telepathy-logger.h @@ -21,6 +21,7 @@ #ifndef __TELEPATHY_LOGGER_H__ #define __TELEPATHY_LOGGER_H__ +#include <telepathy-logger/debug.h> #include <telepathy-logger/entity.h> #include <telepathy-logger/text-event.h> #include <telepathy-logger/call-event.h> |