/[pcsclite]/trunk/Drivers/ccid/src/debug.h
ViewVC logotype

Contents of /trunk/Drivers/ccid/src/debug.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1409 - (show annotations) (download)
Thu Mar 17 10:24:41 2005 UTC (8 years, 3 months ago) by rousseau
File MIME type: text/plain
File size: 3370 byte(s)
use pcsclite debuglog.h header file and use its Log?() macro instead of
debug_msg().

This adds color to the log messages because Log?() macros use log_msg()
instead of the deprecated debug_msg() function.
1 /*
2 debug.h: log (or not) messages using syslog
3 Copyright (C) 2003-2005 Ludovic Rousseau
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 /*
21 * $Id$
22 */
23
24 /*
25 * DEBUG_CRITICAL("text");
26 * log "text" if (LogLevel & DEBUG_LEVEL_CRITICAL) is TRUE
27 *
28 * DEBUG_CRITICAL2("text: %d", 1234);
29 * log "text: 1234" if (DEBUG_LEVEL_CRITICAL & DEBUG_LEVEL_CRITICAL) is TRUE
30 * the format string can be anything printf() can understand
31 *
32 * same thing for DEBUG_INFO, DEBUG_COMM and DEBUG_PERIODIC
33 *
34 * DEBUG_XXD(msg, buffer, size);
35 * log a dump of buffer if (LogLevel & DEBUG_LEVEL_COMM) is TRUE
36 *
37 */
38
39 #ifndef _GCDEBUG_H_
40 #define _GCDEBUG_H_
41
42 /* You can't do #ifndef __FUNCTION__ */
43 #if !defined(__GNUC__) && !defined(__IBMC__)
44 #define __FUNCTION__ ""
45 #endif
46
47 extern int LogLevel;
48
49 #define DEBUG_LEVEL_CRITICAL 1
50 #define DEBUG_LEVEL_INFO 2
51 #define DEBUG_LEVEL_PERIODIC 4
52 #define DEBUG_LEVEL_COMM 8
53
54 #include <debuglog.h> /* from pcsc-lite */
55
56 /* DEBUG_CRITICAL */
57 #define DEBUG_CRITICAL(fmt) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log1(PCSC_LOG_CRITICAL, fmt)
58
59 #define DEBUG_CRITICAL2(fmt, data) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log2(PCSC_LOG_CRITICAL, fmt, data)
60
61 #define DEBUG_CRITICAL3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log3(PCSC_LOG_CRITICAL, fmt, data1, data2)
62
63 #define DEBUG_CRITICAL4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log4(PCSC_LOG_CRITICAL, fmt, data1, data2, data3)
64
65 /* DEBUG_INFO */
66 #define DEBUG_INFO(fmt) if (LogLevel & DEBUG_LEVEL_INFO) Log1(PCSC_LOG_INFO, fmt)
67
68 #define DEBUG_INFO2(fmt, data) if (LogLevel & DEBUG_LEVEL_INFO) Log2(PCSC_LOG_INFO, fmt, data)
69
70 #define DEBUG_INFO3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_INFO) Log3(PCSC_LOG_INFO, fmt, data1, data2)
71
72 #define DEBUG_INFO4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_INFO) Log4(PCSC_LOG_INFO, fmt, data1, data2, data3)
73
74 /* DEBUG_PERIODIC */
75 #define DEBUG_PERIODIC(fmt) if (LogLevel & DEBUG_LEVEL_PERIODIC) Log1(PCSC_LOG_DEBUG, fmt)
76
77 #define DEBUG_PERIODIC2(fmt, data) if (LogLevel & DEBUG_LEVEL_PERIODIC) Log2(PCSC_LOG_DEBUG, fmt, data)
78
79 /* DEBUG_COMM */
80 #define DEBUG_COMM(fmt) if (LogLevel & DEBUG_LEVEL_COMM) Log1(PCSC_LOG_DEBUG, fmt)
81
82 #define DEBUG_COMM2(fmt, data) if (LogLevel & DEBUG_LEVEL_COMM) Log2(PCSC_LOG_DEBUG, fmt, data)
83
84 #define DEBUG_COMM3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_COMM) Log3(PCSC_LOG_DEBUG, fmt, data1, data2)
85
86 #define DEBUG_COMM4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_COMM) Log4(PCSC_LOG_DEBUG, fmt, data1, data2, data3)
87
88 /* DEBUG_XXD */
89 #define DEBUG_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_COMM) log_xxd(PCSC_LOG_DEBUG, msg, buffer, size)
90
91 #endif
92

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5