[libpeas] Show debugging log messages only when PEAS_DEBUG is set
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Show debugging log messages only when PEAS_DEBUG is set
- Date: Thu, 1 Jul 2010 22:55:08 +0000 (UTC)
commit 48c847c31fa5931668f30502ac8434cb14bd3aad
Author: Garrett Regier <alias301 gmail com>
Date: Mon Jun 28 10:01:50 2010 -0700
Show debugging log messages only when PEAS_DEBUG is set
https://bugzilla.gnome.org/show_bug.cgi?id=622997
libpeas/Makefile.am | 2 ++
libpeas/peas-debug.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
libpeas/peas-debug.h | 34 ++++++++++++++++++++++++++++++++++
libpeas/peas-engine.c | 5 +++++
4 files changed, 88 insertions(+), 0 deletions(-)
---
diff --git a/libpeas/Makefile.am b/libpeas/Makefile.am
index 18731fd..43fde6c 100644
--- a/libpeas/Makefile.am
+++ b/libpeas/Makefile.am
@@ -26,6 +26,7 @@ INST_H_FILES = \
peas-engine.h
NOINST_H_FILES = \
+ peas-debug.h \
peas-dirs.h \
peas-i18n.h \
peas-introspection.h \
@@ -33,6 +34,7 @@ NOINST_H_FILES = \
peas-plugin-loader.h
C_FILES = \
+ peas-debug.c \
peas-dirs.c \
peas-i18n.c \
peas-object-module.c \
diff --git a/libpeas/peas-debug.c b/libpeas/peas-debug.c
new file mode 100644
index 0000000..c94d672
--- /dev/null
+++ b/libpeas/peas-debug.c
@@ -0,0 +1,47 @@
+/*
+ * peas-debug.c
+ * This file is part of libpeas
+ *
+ * Copyright (C) 2010 - Garrett Regier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "libpeas/peas-debug.h"
+
+
+static void
+debug_log_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+}
+
+void
+peas_debug_init (void)
+{
+ if (g_getenv ("PEAS_DEBUG") == NULL)
+ {
+ g_log_set_handler (G_LOG_DOMAIN,
+ G_LOG_LEVEL_DEBUG,
+ debug_log_handler,
+ NULL);
+ }
+}
diff --git a/libpeas/peas-debug.h b/libpeas/peas-debug.h
new file mode 100644
index 0000000..79c006e
--- /dev/null
+++ b/libpeas/peas-debug.h
@@ -0,0 +1,34 @@
+/*
+ * peas-debug.h
+ * This file is part of libpeas
+ *
+ * Copyright (C) 2010 - Garrett Regier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __PEAS_DEBUG_H__
+#define __PEAS_DEBUG_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+void peas_debug_init (void);
+
+G_END_DECLS
+
+#endif /* __PEAS_DEBUG_H__ */
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index f2737d0..6b4c8a6 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -33,6 +33,7 @@
#include "peas-object-module.h"
#include "peas-extension.h"
#include "peas-dirs.h"
+#include "peas-debug.h"
/**
* SECTION:peas-engine
@@ -503,6 +504,10 @@ peas_engine_class_init (PeasEngineClass *klass)
G_SIGNAL_TYPE_STATIC_SCOPE);
g_type_class_add_private (klass, sizeof (PeasEnginePrivate));
+
+ /* We are doing some global initialization here as there is currently no
+ * global init function for libpeas. */
+ peas_debug_init ();
}
static LoaderInfo *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]