/*
 * Purple - Internet Messaging Library
 * Copyright (C) Pidgin Developers <devel@pidgin.im>
 *
 * Purple is the legal property of its developers, whose names are too numerous
 * to list here. Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This library 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 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 General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this library; if not, see <https://www.gnu.org/licenses/>.
 */

#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
# error "only <purple.h> may be included directly"
#endif

#ifndef PURPLE_DEBUG_H
#define PURPLE_DEBUG_H

#include <glib.h>
#include <glib-object.h>

#include "purpleversion.h"

G_BEGIN_DECLS

/**
 * PurpleDebugLevel:
 * @PURPLE_DEBUG_ALL: All debug levels.
 * @PURPLE_DEBUG_MISC: General chatter.
 * @PURPLE_DEBUG_INFO: General operation Information.
 * @PURPLE_DEBUG_WARNING: Warnings.
 * @PURPLE_DEBUG_ERROR: Errors.
 * @PURPLE_DEBUG_FATAL: Fatal errors.
 *
 * Available debug levels.
 *
 * Since: 2.0
 */
typedef enum {
	PURPLE_DEBUG_ALL = 0,
	PURPLE_DEBUG_MISC,
	PURPLE_DEBUG_INFO,
	PURPLE_DEBUG_WARNING,
	PURPLE_DEBUG_ERROR,
	PURPLE_DEBUG_FATAL

} PurpleDebugLevel;

/**
 * purple_debug_misc:
 * @category: The category or %NULL.
 * @format: The format string.
 * @...:  The parameters to insert into the format string.
 *
 * Outputs miscellaneous level debug information.
 *
 * See g_info()
 *
 * Since: 2.0
 */
#define purple_debug_misc(category, format, ...) (g_log(category, G_LOG_LEVEL_INFO, format, ##__VA_ARGS__))

/**
 * purple_debug_info:
 * @category: The category (or %NULL).
 * @format: The format string.
 * @...: The parameters to insert into the format string.
 *
 * Outputs info level debug information.
 *
 * See g_message()
 *
 * Since: 2.0
 */
#define purple_debug_info(category, format, ...) (g_log(category, G_LOG_LEVEL_MESSAGE, format, ##__VA_ARGS__))

/**
 * purple_debug_warning:
 * @category: The category or %NULL.
 * @format: The format string.
 * @...: The parameters to insert into the format string.
 *
 * Outputs warning level debug information.
 *
 * See g_warning()
 *
 * Since: 2.0
 */
#define purple_debug_warning(category, format, ...) (g_log(category, G_LOG_LEVEL_WARNING, format, ##__VA_ARGS__))

/**
 * purple_debug_error:
 * @category: The category or %NULL.
 * @format: The format string.
 * @...: The parameters to insert into the format string.
 *
 * Outputs error level debug information.
 *
 * This is a wrapper for purple_debug(), and uses #PURPLE_DEBUG_ERROR as the
 * level.
 *
 * See g_critical()
 *
 * Since: 2.0
 */
#define purple_debug_error(category, format, ...) (g_log(category, G_LOG_LEVEL_CRITICAL, format, ##__VA_ARGS__))

/**
 * purple_debug_fatal:
 * @category: The category (or %NULL).
 * @format: The format string.
 * @...: The parameters to insert into the format string.
 *
 * Outputs fatal error level debug information.
 *
 * See g_error()
 *
 * Since: 2.0
 */
#define purple_debug_fatal(category, format, ...) (g_log(category, G_LOG_LEVEL_ERROR, format, ##__VA_ARGS__))

G_END_DECLS

#endif /* PURPLE_DEBUG_H */
