public
Description: MSN Messenger library in C
Homepage: http://code.google.com/p/msn-pecan/
Clone URL: git://github.com/felipec/msn-pecan.git
ceyusa (author)
Sun Sep 14 14:48:47 -0700 2008
felipec (committer)
Sun Sep 14 14:48:47 -0700 2008
msn-pecan / pecan_log.h
100644 82 lines (63 sloc) 2.472 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * Copyright (C) 2007-2008 Felipe Contreras
 *
 * 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 02111-1301 USA
 */
 
#ifndef PECAN_LOG_H
#define PECAN_LOG_H
 
#include <glib.h>
#include "msn.h"
 
#define PECAN_DEBUG
 
#if defined(PECAN_DEBUG)
 
/* #define PECAN_DEBUG_MSG */
/* #define PECAN_DEBUG_SLPMSG */
/* #define PECAN_DEBUG_HTTP */
 
/* #define PECAN_DEBUG_SLP_VERBOSE */
/* #define PECAN_DEBUG_SLP_FILES */
 
/* #define PECAN_DEBUG_NS */
/* #define PECAN_DEBUG_SB */
/* #define PECAN_DEBUG_DC */
 
/* #define PECAN_DEBUG_DC_FILES */
 
enum PecanLogLevel
{
    PECAN_LOG_LEVEL_NONE,
    PECAN_LOG_LEVEL_ERROR,
    PECAN_LOG_LEVEL_WARNING,
    PECAN_LOG_LEVEL_INFO,
    PECAN_LOG_LEVEL_DEBUG,
    PECAN_LOG_LEVEL_LOG
};
 
typedef enum PecanLogLevel PecanLogLevel;
 
void msn_base_log_helper (PecanLogLevel level, const gchar *file, const gchar *function, gint line, const gchar *fmt, ...);
#ifdef PECAN_DUMP_FILE
void msn_dump_file (const gchar *buffer, gsize len);
#endif /* PECAN_DUMP_FILE */
 
#define pecan_print(...) g_print (__VA_ARGS__);
 
#define msn_base_log(level, ...) msn_base_log_helper (level, __FILE__, __func__, __LINE__, __VA_ARGS__);
 
#define pecan_error(...) msn_base_log (PECAN_LOG_LEVEL_ERROR, __VA_ARGS__);
#define pecan_warning(...) msn_base_log (PECAN_LOG_LEVEL_WARNING, __VA_ARGS__);
#define pecan_info(...) msn_base_log (PECAN_LOG_LEVEL_INFO, __VA_ARGS__);
#define pecan_debug(...) msn_base_log (PECAN_LOG_LEVEL_DEBUG, __VA_ARGS__);
#define pecan_log(...) msn_base_log (PECAN_LOG_LEVEL_LOG, __VA_ARGS__);
 
#elif !defined(PECAN_DEBUG)
 
#define pecan_print(...) {}
#define pecan_error(...) {}
#define pecan_warning(...) {}
#define pecan_info(...) {}
#define pecan_debug(...) {}
#define pecan_log(...) {}
#define msn_dump_file(...) {}
 
#endif /* !defined(PECAN_DEBUG) */
 
#endif /* PECAN_LOG_H */