| 1 |
corcoran |
11 |
/******************************************************************
|
| 2 |
|
|
|
| 3 |
|
|
MUSCLE SmartCard Development ( http://www.linuxnet.com )
|
| 4 |
|
|
Title : debuglog.h
|
| 5 |
|
|
Package: pcsc lite
|
| 6 |
|
|
Author : David Corcoran
|
| 7 |
|
|
Ludovic Rousseau
|
| 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.
|
| 12 |
|
|
|
| 13 |
|
|
********************************************************************/
|
| 14 |
|
|
|
| 15 |
|
|
/*
|
| 16 |
|
|
* DebugLogA("text");
|
| 17 |
|
|
* send "text" to syslog if USE_SYSLOG is defined
|
| 18 |
|
|
* print to stderr "text" if USE_SYSLOG is NOT defined
|
| 19 |
|
|
*
|
| 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
|
| 24 |
|
|
*
|
| 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[]
|
| 28 |
|
|
*
|
| 29 |
|
|
*/
|
| 30 |
|
|
|
| 31 |
|
|
#ifndef __debuglog_h__
|
| 32 |
|
|
#define __debuglog_h__
|
| 33 |
|
|
|
| 34 |
|
|
#ifdef __cplusplus
|
| 35 |
|
|
extern "C" {
|
| 36 |
|
|
#endif
|
| 37 |
|
|
|
| 38 |
|
|
#define DEBUGLOG_LOG_ENTRIES 1
|
| 39 |
|
|
#define DEBUGLOG_IGNORE_ENTRIES 2
|
| 40 |
|
|
|
| 41 |
corcoran |
14 |
#define DEBUGLOG_NO_DEBUG 0
|
| 42 |
|
|
#define DEBUGLOG_SYSLOG_DEBUG 1
|
| 43 |
|
|
#define DEBUGLOG_STDERR_DEBUG 2
|
| 44 |
|
|
#define DEBUGLOG_STDOUT_DEBUG 4
|
| 45 |
|
|
|
| 46 |
corcoran |
11 |
#ifdef PCSC_DEBUG
|
| 47 |
|
|
#define DebugLogA(fmt) debug_msg("%s:%d " fmt, __FILE__, __LINE__)
|
| 48 |
|
|
#define DebugLogB(fmt, data) debug_msg("%s:%d " fmt, __FILE__, __LINE__, data)
|
| 49 |
|
|
#define DebugLogC(fmt, data) debug_msg("%s:%d " fmt, __FILE__, __LINE__, data)
|
| 50 |
|
|
#define DebugXxd(msg, buffer, size) debug_xxd(msg, buffer, size)
|
| 51 |
|
|
#else
|
| 52 |
|
|
#define DebugLogA(fmt)
|
| 53 |
|
|
#define DebugLogB(fmt, data)
|
| 54 |
|
|
#define DebugLogC(fmt, data1)
|
| 55 |
|
|
#define DebugXxd(msg, buffer, size)
|
| 56 |
|
|
#endif
|
| 57 |
|
|
|
| 58 |
|
|
void debug_msg(char *fmt, ...);
|
| 59 |
|
|
void debug_xxd(const char *msg, const unsigned char *buffer, const int size);
|
| 60 |
|
|
|
| 61 |
|
|
void DebugLogSuppress( long );
|
| 62 |
corcoran |
14 |
void DebugLogSetLogType( long );
|
| 63 |
corcoran |
11 |
|
| 64 |
|
|
char* pcsc_stringify_error ( long );
|
| 65 |
|
|
|
| 66 |
|
|
#ifdef __cplusplus
|
| 67 |
|
|
}
|
| 68 |
|
|
#endif
|
| 69 |
|
|
|
| 70 |
|
|
#endif /* __debuglog_h__ */
|
| 71 |
|
|
|