2007-08-23 14:54:35 -07:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
|
|
|
*
|
2008-02-13 13:50:39 -08:00
|
|
|
* Copyright (C) 2007-2008 Richard Hughes <richard@hughsie.com>
|
2007-08-23 14:54:35 -07:00
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PK_DEBUG_H
|
|
|
|
#define __PK_DEBUG_H
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
2008-02-12 14:52:37 -08:00
|
|
|
/**
|
|
|
|
* pk_debug:
|
|
|
|
*
|
|
|
|
* Non critical debugging
|
|
|
|
*/
|
2007-08-23 14:54:35 -07:00
|
|
|
#define pk_debug(...) pk_debug_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
|
2008-02-12 14:52:37 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pk_warning:
|
|
|
|
*
|
|
|
|
* Important debugging
|
|
|
|
*/
|
2007-08-23 14:54:35 -07:00
|
|
|
#define pk_warning(...) pk_warning_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
|
2008-02-12 14:52:37 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pk_error:
|
|
|
|
*
|
|
|
|
* Critical debugging, with exit
|
|
|
|
*/
|
2007-08-23 14:54:35 -07:00
|
|
|
#define pk_error(...) pk_error_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
|
2008-02-12 14:52:37 -08:00
|
|
|
|
2007-08-23 14:54:35 -07:00
|
|
|
#elif defined(__GNUC__) && __GNUC__ >= 3
|
|
|
|
#define pk_debug(...) pk_debug_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
|
|
|
|
#define pk_warning(...) pk_warning_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
|
|
|
|
#define pk_error(...) pk_error_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
|
|
|
|
#else
|
|
|
|
#define pk_debug
|
|
|
|
#define pk_warning
|
|
|
|
#define pk_error
|
|
|
|
#define pk_assert_run_once(x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void pk_debug_init (gboolean debug);
|
2008-01-04 06:47:25 -08:00
|
|
|
gboolean pk_debug_enabled (void);
|
2007-08-23 14:54:35 -07:00
|
|
|
void pk_debug_real (const gchar *func,
|
|
|
|
const gchar *file,
|
|
|
|
int line,
|
2007-08-29 07:58:16 -07:00
|
|
|
const gchar *format, ...) __attribute__((format (printf,4,5)));
|
2007-08-27 11:44:52 -07:00
|
|
|
void pk_warning_real (const gchar *func,
|
2007-08-23 14:54:35 -07:00
|
|
|
const gchar *file,
|
|
|
|
int line,
|
2007-08-29 07:58:16 -07:00
|
|
|
const gchar *format, ...) __attribute__((format (printf,4,5)));
|
2007-08-23 14:54:35 -07:00
|
|
|
void pk_error_real (const gchar *func,
|
|
|
|
const gchar *file,
|
|
|
|
int line,
|
2007-08-29 07:58:16 -07:00
|
|
|
const gchar *format, ...) __attribute__((format (printf,4,5)));
|
2007-08-23 14:54:35 -07:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __PK_DEBUG_H */
|