/[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 - (hide 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 rousseau 269 /*
2     debug.h: log (or not) messages using syslog
3 rousseau 1409 Copyright (C) 2003-2005 Ludovic Rousseau
4 rousseau 269
5 rousseau 1399 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 rousseau 269
10 rousseau 1399 This library is distributed in the hope that it will be useful,
11 rousseau 269 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 rousseau 1399 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14 rousseau 269
15 rousseau 1399 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 rousseau 269 */
19    
20     /*
21     * $Id$
22     */
23    
24     /*
25     * DEBUG_CRITICAL("text");
26 rousseau 772 * log "text" if (LogLevel & DEBUG_LEVEL_CRITICAL) is TRUE
27 rousseau 269 *
28 rousseau 772 * DEBUG_CRITICAL2("text: %d", 1234);
29     * log "text: 1234" if (DEBUG_LEVEL_CRITICAL & DEBUG_LEVEL_CRITICAL) is TRUE
30 rousseau 269 * the format string can be anything printf() can understand
31     *
32 rousseau 772 * same thing for DEBUG_INFO, DEBUG_COMM and DEBUG_PERIODIC
33 rousseau 269 *
34 rousseau 772 * DEBUG_XXD(msg, buffer, size);
35     * log a dump of buffer if (LogLevel & DEBUG_LEVEL_COMM) is TRUE
36 rousseau 269 *
37     */
38    
39     #ifndef _GCDEBUG_H_
40     #define _GCDEBUG_H_
41    
42 rousseau 580 /* You can't do #ifndef __FUNCTION__ */
43     #if !defined(__GNUC__) && !defined(__IBMC__)
44     #define __FUNCTION__ ""
45     #endif
46    
47 rousseau 772 extern int LogLevel;
48 rousseau 269
49 rousseau 772 #define DEBUG_LEVEL_CRITICAL 1
50     #define DEBUG_LEVEL_INFO 2
51     #define DEBUG_LEVEL_PERIODIC 4
52     #define DEBUG_LEVEL_COMM 8
53 rousseau 269
54 rousseau 1409 #include <debuglog.h> /* from pcsc-lite */
55 rousseau 269
56 rousseau 772 /* DEBUG_CRITICAL */
57 rousseau 1409 #define DEBUG_CRITICAL(fmt) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log1(PCSC_LOG_CRITICAL, fmt)
58 rousseau 269
59 rousseau 1409 #define DEBUG_CRITICAL2(fmt, data) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log2(PCSC_LOG_CRITICAL, fmt, data)
60 rousseau 269
61 rousseau 1409 #define DEBUG_CRITICAL3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log3(PCSC_LOG_CRITICAL, fmt, data1, data2)
62 rousseau 772
63 rousseau 1409 #define DEBUG_CRITICAL4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log4(PCSC_LOG_CRITICAL, fmt, data1, data2, data3)
64 rousseau 772
65     /* DEBUG_INFO */
66 rousseau 1409 #define DEBUG_INFO(fmt) if (LogLevel & DEBUG_LEVEL_INFO) Log1(PCSC_LOG_INFO, fmt)
67 rousseau 772
68 rousseau 1409 #define DEBUG_INFO2(fmt, data) if (LogLevel & DEBUG_LEVEL_INFO) Log2(PCSC_LOG_INFO, fmt, data)
69 rousseau 772
70 rousseau 1409 #define DEBUG_INFO3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_INFO) Log3(PCSC_LOG_INFO, fmt, data1, data2)
71 rousseau 772
72 rousseau 1409 #define DEBUG_INFO4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_INFO) Log4(PCSC_LOG_INFO, fmt, data1, data2, data3)
73 rousseau 772
74     /* DEBUG_PERIODIC */
75 rousseau 1409 #define DEBUG_PERIODIC(fmt) if (LogLevel & DEBUG_LEVEL_PERIODIC) Log1(PCSC_LOG_DEBUG, fmt)
76 rousseau 772
77 rousseau 1409 #define DEBUG_PERIODIC2(fmt, data) if (LogLevel & DEBUG_LEVEL_PERIODIC) Log2(PCSC_LOG_DEBUG, fmt, data)
78 rousseau 772
79     /* DEBUG_COMM */
80 rousseau 1409 #define DEBUG_COMM(fmt) if (LogLevel & DEBUG_LEVEL_COMM) Log1(PCSC_LOG_DEBUG, fmt)
81 rousseau 772
82 rousseau 1409 #define DEBUG_COMM2(fmt, data) if (LogLevel & DEBUG_LEVEL_COMM) Log2(PCSC_LOG_DEBUG, fmt, data)
83 rousseau 772
84 rousseau 1409 #define DEBUG_COMM3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_COMM) Log3(PCSC_LOG_DEBUG, fmt, data1, data2)
85 rousseau 772
86 rousseau 1409 #define DEBUG_COMM4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_COMM) Log4(PCSC_LOG_DEBUG, fmt, data1, data2, data3)
87 rousseau 772
88     /* DEBUG_XXD */
89 rousseau 1409 #define DEBUG_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_COMM) log_xxd(PCSC_LOG_DEBUG, msg, buffer, size)
90 rousseau 772
91 rousseau 269 #endif
92    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5