Frameworks/libpurple.framework/Versions/0.6.2/Headers/pecan_log.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 1739 Frameworks/libpurple.framework/Versions/0.6.0/Headers/pecan_log.h@8b0daad9656c
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
     1 /**
     2  * Copyright (C) 2007-2008 Felipe Contreras
     3  *
     4  * This program is free software; you can redistribute it and/or modify
     5  * it under the terms of the GNU General Public License as published by
     6  * the Free Software Foundation; either version 2 of the License, or
     7  * (at your option) any later version.
     8  *
     9  * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    13  *
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
    17  */
    18 
    19 #ifndef PECAN_LOG_H
    20 #define PECAN_LOG_H
    21 
    22 #include <glib.h>
    23 #include "msn.h"
    24 
    25 #define PECAN_DEBUG
    26 
    27 #if defined(PECAN_DEBUG)
    28 
    29 /* #define PECAN_DEBUG_MSG */
    30 /* #define PECAN_DEBUG_SLPMSG */
    31 /* #define PECAN_DEBUG_HTTP */
    32 
    33 /* #define PECAN_DEBUG_SLP_VERBOSE */
    34 /* #define PECAN_DEBUG_SLP_FILES  */
    35 
    36 /* #define PECAN_DEBUG_NS */
    37 /* #define PECAN_DEBUG_SB */
    38 /* #define PECAN_DEBUG_DC */
    39 
    40 /* #define PECAN_DEBUG_DC_FILES */
    41 
    42 enum PecanLogLevel
    43 {
    44     PECAN_LOG_LEVEL_NONE,
    45     PECAN_LOG_LEVEL_ERROR,
    46     PECAN_LOG_LEVEL_WARNING,
    47     PECAN_LOG_LEVEL_INFO,
    48     PECAN_LOG_LEVEL_DEBUG,
    49     PECAN_LOG_LEVEL_LOG
    50 };
    51 
    52 typedef enum PecanLogLevel PecanLogLevel;
    53 
    54 void msn_base_log_helper (PecanLogLevel level, const gchar *file, const gchar *function, gint line, const gchar *fmt, ...);
    55 void msn_dump_file (const gchar *buffer, gsize len);
    56 
    57 #define pecan_print(...) g_print (__VA_ARGS__);
    58 
    59 #define msn_base_log(level, ...) msn_base_log_helper (level, __FILE__, __func__, __LINE__, __VA_ARGS__);
    60 
    61 #define pecan_error(...) msn_base_log (PECAN_LOG_LEVEL_ERROR, __VA_ARGS__);
    62 #define pecan_warning(...) msn_base_log (PECAN_LOG_LEVEL_WARNING, __VA_ARGS__);
    63 #define pecan_info(...) msn_base_log (PECAN_LOG_LEVEL_INFO, __VA_ARGS__);
    64 #define pecan_debug(...) msn_base_log (PECAN_LOG_LEVEL_DEBUG, __VA_ARGS__);
    65 #define pecan_log(...) msn_base_log (PECAN_LOG_LEVEL_LOG, __VA_ARGS__);
    66 
    67 #elif !defined(PECAN_DEBUG)
    68 
    69 #define pecan_print(...) {}
    70 #define pecan_error(...) {}
    71 #define pecan_warning(...) {}
    72 #define pecan_info(...) {}
    73 #define pecan_debug(...) {}
    74 #define pecan_log(...) {}
    75 #define msn_dump_file(...) {}
    76 
    77 #endif /* !defined(PECAN_DEBUG) */
    78 
    79 #endif /* PECAN_LOG_H */