1
/******************************************************************
3
MUSCLE SmartCard Development ( http://www.linuxnet.com )
6
Author : David Corcoran
8
Date : 7/27/99, updated 9 Jan, 2002
9
License: Copyright (C) 1999 David Corcoran
10
<corcoran@linuxnet.com>
11
Purpose: This handles debugging.
13
********************************************************************/
2
* This handles debugging.
4
* MUSCLE SmartCard Development ( http://www.linuxnet.com )
6
* Copyright (C) 1999-2002
7
* David Corcoran <corcoran@linuxnet.com>
8
* Ludovic Rousseau <ludovic.rousseau@free.fr>
10
* $Id: debuglog.h,v 1.11 2004/04/21 21:40:19 rousseau Exp $
14
* log message is sent to syslog, stdout or stderr depending on --debug
15
* command line argument
16
17
* DebugLogA("text");
17
* send "text" to syslog if USE_SYSLOG is defined
18
* print to stderr "text" if USE_SYSLOG is NOT defined
20
* DebugLogB("text: %d", 1234)
21
* send "text: 1234" to syslog if USE_SYSLOG is defined
22
* print to stderr "text: 1234" is USE_SYSLOG is NOT defined
23
* the format string can be anything printf() can understand
25
* DebugXxd(msg, buffer, size)
26
* send to syslog (if USE_SYSLOG is defined) or print to stderr
27
* "msg" + a hex dump of size bytes of buffer[]
20
* DebugLogB("text: %d", 1234);
22
* the format string can be anything printf() can understand
24
* DebugLogC("text: %d %d", 1234, 5678);
25
* log "text: 1234 5678"
26
* the format string can be anything printf() can understand
28
* DebugXxd(msg, buffer, size);
29
* log "msg" + a hex dump of size bytes of buffer[]
32
34
#define __debuglog_h__
38
41
#define DEBUGLOG_LOG_ENTRIES 1
39
42
#define DEBUGLOG_IGNORE_ENTRIES 2
41
/*void DebugLogA( LPCSTR, LPCSTR, LONG );
43
void DebugLogB( LPCSTR, LONG, LPCSTR, LONG );
45
void DebugLogC( LPCSTR, LPCSTR, LPCSTR, LONG );
47
void DebugLogD( LPCSTR, PUCHAR, LONG, LPCSTR, LONG );*/
45
DEBUGLOG_NO_DEBUG = 0,
46
DEBUGLOG_SYSLOG_DEBUG,
47
DEBUGLOG_STDERR_DEBUG,
48
DEBUGLOG_STDOUT_DEBUG,
51
#define DEBUG_CATEGORY_NOTHING 0
52
#define DEBUG_CATEGORY_APDU 1
53
#define DEBUG_CATEGORY_SW 2
55
/* You can't do #ifndef __FUNCTION__ */
56
#if !defined(__GNUC__) && !defined(__IBMC__)
57
#define __FUNCTION__ ""
50
#define DebugLogA(fmt) debug_msg("%s:%d " fmt, __FILE__, __LINE__)
51
#define DebugLogB(fmt, data) debug_msg("%s:%d " fmt, __FILE__, __LINE__, data)
52
#define DebugLogC(fmt, data1, data2) debug_msg("%s:%d " fmt, __FILE__, __LINE__, data1, data2)
61
#define DebugLogA(fmt) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
62
#define DebugLogB(fmt, data) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
63
#define DebugLogC(fmt, data1, data2) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
53
64
#define DebugXxd(msg, buffer, size) debug_xxd(msg, buffer, size)
55
66
#define DebugLogA(fmt)
58
69
#define DebugXxd(msg, buffer, size)
61
void debug_msg(char *fmt, ...);
72
void debug_msg(const char *fmt, ...);
62
73
void debug_xxd(const char *msg, const unsigned char *buffer, const int size);
64
void DebugLogSuppress( LONG );
75
void DebugLogSuppress(const int);
76
void DebugLogSetLogType(const int);
77
int DebugLogSetCategory(const int);
78
void DebugLogCategory(const int, const char *, const int);
66
LPSTR pcsc_stringify_error ( LONG );
80
char *pcsc_stringify_error(long);
72
#endif /* __debuglog_h__ */
86
#endif /* __debuglog_h__ */