/[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 995 - (hide annotations) (download)
Wed Jun 30 13:28:22 2004 UTC (8 years, 10 months ago) by rousseau
File MIME type: text/plain
File size: 3876 byte(s)
we do not need to have PACKAGE defined (I do not remember what it was
used for)
1 rousseau 269 /*
2     debug.h: log (or not) messages using syslog
3     Copyright (C) 2003 Ludovic Rousseau
4    
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9    
10     This program 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
13     GNU General Public License for more details.
14    
15     You should have received a copy of the GNU General Public License
16     along with this program; 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 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    
55 rousseau 772 /* DEBUG_CRITICAL */
56     #define DEBUG_CRITICAL(fmt) if (LogLevel & DEBUG_LEVEL_CRITICAL) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
57 rousseau 269
58 rousseau 772 #define DEBUG_CRITICAL2(fmt, data) if (LogLevel & DEBUG_LEVEL_CRITICAL) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
59 rousseau 269
60 rousseau 772 #define DEBUG_CRITICAL3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_CRITICAL) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
61    
62     #define DEBUG_CRITICAL4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_CRITICAL) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
63    
64     /* DEBUG_INFO */
65     #define DEBUG_INFO(fmt) if (LogLevel & DEBUG_LEVEL_INFO) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
66    
67     #define DEBUG_INFO2(fmt, data) if (LogLevel & DEBUG_LEVEL_INFO) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
68    
69     #define DEBUG_INFO3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_INFO) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
70    
71     #define DEBUG_INFO4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_INFO) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
72    
73     /* DEBUG_PERIODIC */
74     #define DEBUG_PERIODIC(fmt) if (LogLevel & DEBUG_LEVEL_PERIODIC) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
75    
76     #define DEBUG_PERIODIC2(fmt, data) if (LogLevel & DEBUG_LEVEL_PERIODIC) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
77    
78     /* DEBUG_COMM */
79     #define DEBUG_COMM(fmt) if (LogLevel & DEBUG_LEVEL_COMM) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
80    
81     #define DEBUG_COMM2(fmt, data) if (LogLevel & DEBUG_LEVEL_COMM)debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
82    
83     #define DEBUG_COMM3(fmt, data1, data2) if (LogLevel & DEBUG_LEVEL_COMM)debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
84    
85     #define DEBUG_COMM4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_COMM)debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
86    
87     /* DEBUG_XXD */
88     #define DEBUG_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_COMM) debug_xxd(msg, buffer, size)
89    
90 rousseau 269 void debug_msg(char *fmt, ...);
91     void debug_xxd(const char *msg, const unsigned char *buffer, const int size);
92    
93     #endif
94    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5