summaryrefslogtreecommitdiff
path: root/applets/brightness/egg-debug.h
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2011-12-11 12:55:19 +0100
committerStefano Karapetsas <[email protected]>2011-12-11 12:55:19 +0100
commit51175189c6d7313a3b84019e39496f957c4e6164 (patch)
treee4c2c130fa3140bca28685ef900f04a012e53dcd /applets/brightness/egg-debug.h
downloadmate-power-manager-51175189c6d7313a3b84019e39496f957c4e6164.tar.bz2
mate-power-manager-51175189c6d7313a3b84019e39496f957c4e6164.tar.xz
moved from Mate-Extra
Diffstat (limited to 'applets/brightness/egg-debug.h')
-rw-r--r--applets/brightness/egg-debug.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/applets/brightness/egg-debug.h b/applets/brightness/egg-debug.h
new file mode 100644
index 0000000..fdfb02b
--- /dev/null
+++ b/applets/brightness/egg-debug.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007-2008 Richard Hughes <[email protected]>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __EGG_DEBUG_H
+#define __EGG_DEBUG_H
+
+#include <stdarg.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+/**
+ * egg_debug:
+ *
+ * Non critical debugging
+ */
+#define egg_debug(...) egg_debug_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
+
+/**
+ * egg_warning:
+ *
+ * Important debugging
+ */
+#define egg_warning(...) egg_warning_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
+
+/**
+ * egg_error:
+ *
+ * Critical debugging, with exit
+ */
+#define egg_error(...) egg_error_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
+
+#elif defined(__GNUC__) && __GNUC__ >= 3
+#define egg_debug(...) egg_debug_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
+#define egg_warning(...) egg_warning_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
+#define egg_error(...) egg_error_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
+#else
+#define egg_debug(...)
+#define egg_warning(...)
+#define egg_error(...)
+#endif
+
+void egg_debug_init (gboolean debug);
+void egg_debug_set_logging (gboolean enabled);
+gboolean egg_debug_enabled (void);
+gboolean egg_debug_is_logging (void);
+gboolean egg_debug_is_console (void);
+void egg_debug_backtrace (void);
+void egg_debug_real (const gchar *func,
+ const gchar *file,
+ int line,
+ const gchar *format, ...) __attribute__((format (printf,4,5)));
+void egg_warning_real (const gchar *func,
+ const gchar *file,
+ int line,
+ const gchar *format, ...) __attribute__((format (printf,4,5)));
+void egg_error_real (const gchar *func,
+ const gchar *file,
+ int line,
+ const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5)));
+
+G_END_DECLS
+
+#endif /* __EGG_DEBUG_H */