Blame telepathy-account-widgets/tp-account-widgets/tpaw-debug.h

Packit 79f644
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
Packit 79f644
/*
Packit 79f644
 * Copyright (C) 2007 Collabora Ltd.
Packit 79f644
 * Copyright (C) 2007 Nokia Corporation
Packit 79f644
 *
Packit 79f644
 * This library is free software; you can redistribute it and/or
Packit 79f644
 * modify it under the terms of the GNU Lesser General Public
Packit 79f644
 * License as published by the Free Software Foundation; either
Packit 79f644
 * version 2.1 of the License, or (at your option) any later version.
Packit 79f644
 *
Packit 79f644
 * This library is distributed in the hope that it will be useful,
Packit 79f644
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 79f644
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 79f644
 * Lesser General Public License for more details.
Packit 79f644
 *
Packit 79f644
 * You should have received a copy of the GNU Lesser General Public
Packit 79f644
 * License along with this library; if not, write to the Free Software
Packit 79f644
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 79f644
 */
Packit 79f644
Packit 79f644
#ifndef __TPAW_DEBUG_H__
Packit 79f644
#define __TPAW_DEBUG_H__
Packit 79f644
Packit 79f644
#include <glib.h>
Packit 79f644
#include <telepathy-glib/telepathy-glib.h>
Packit 79f644
Packit 79f644
G_BEGIN_DECLS
Packit 79f644
Packit 79f644
/* Please keep this enum in sync with #keys in tpaw-debug.c */
Packit 79f644
typedef enum
Packit 79f644
{
Packit 79f644
  TPAW_DEBUG_CONTACT = 1 << 1,
Packit 79f644
  TPAW_DEBUG_ACCOUNT = 1 << 2,
Packit 79f644
  TPAW_DEBUG_IRC = 1 << 3,
Packit 79f644
  TPAW_DEBUG_OTHER = 1 << 4,
Packit 79f644
} TpawDebugFlags;
Packit 79f644
Packit 79f644
gboolean tpaw_debug_flag_is_set (TpawDebugFlags flag);
Packit 79f644
void tpaw_debug (TpawDebugFlags flag, const gchar *format, ...)
Packit 79f644
    G_GNUC_PRINTF (2, 3);
Packit 79f644
void tpaw_debug_free (void);
Packit 79f644
void tpaw_debug_set_flags (const gchar *flags_string);
Packit 79f644
G_END_DECLS
Packit 79f644
Packit 79f644
#endif /* __TPAW_DEBUG_H__ */
Packit 79f644
Packit 79f644
/* ------------------------------------ */
Packit 79f644
Packit 79f644
/* Below this point is outside the __DEBUG_H__ guard - so it can take effect
Packit 79f644
 * more than once. So you can do:
Packit 79f644
 *
Packit 79f644
 * #define DEBUG_FLAG TPAW_DEBUG_ONE_THING
Packit 79f644
 * #include "internal-debug.h"
Packit 79f644
 * ...
Packit 79f644
 * DEBUG ("if we're debugging one thing");
Packit 79f644
 * ...
Packit 79f644
 * #undef DEBUG_FLAG
Packit 79f644
 * #define DEBUG_FLAG TPAW_DEBUG_OTHER_THING
Packit 79f644
 * #include "internal-debug.h"
Packit 79f644
 * ...
Packit 79f644
 * DEBUG ("if we're debugging the other thing");
Packit 79f644
 * ...
Packit 79f644
 */
Packit 79f644
Packit 79f644
#ifdef DEBUG_FLAG
Packit 79f644
#ifdef ENABLE_DEBUG
Packit 79f644
Packit 79f644
#undef DEBUG
Packit 79f644
#define DEBUG(format, ...) \
Packit 79f644
  tpaw_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
Packit 79f644
Packit 79f644
#undef DEBUGGING
Packit 79f644
#define DEBUGGING tpaw_debug_flag_is_set (DEBUG_FLAG)
Packit 79f644
Packit 79f644
#else /* !defined (ENABLE_DEBUG) */
Packit 79f644
Packit 79f644
#undef DEBUG
Packit 79f644
#define DEBUG(format, ...) do {} while (0)
Packit 79f644
Packit 79f644
#undef DEBUGGING
Packit 79f644
#define DEBUGGING 0
Packit 79f644
Packit 79f644
#endif /* !defined (ENABLE_DEBUG) */
Packit 79f644
Packit 79f644
#define gabble_debug_free() G_STMT_START { } G_STMT_END
Packit 79f644
Packit 79f644
#endif /* defined (DEBUG_FLAG) */