pcsc-lite 1.6.4
|
00001 /* 00002 * MUSCLE SmartCard Development ( http://www.linuxnet.com ) 00003 * 00004 * Copyright (C) 1999-2004 00005 * David Corcoran <corcoran@linuxnet.com> 00006 * Copyright (C) 1999-2005 00007 * Ludovic Rousseau <ludovic.rousseau@free.fr> 00008 * 00009 * $Id: debuglog.h 5032 2010-06-22 12:56:20Z rousseau $ 00010 */ 00011 00033 #ifndef __debuglog_h__ 00034 #define __debuglog_h__ 00035 00036 #ifdef __cplusplus 00037 extern "C" 00038 { 00039 #endif 00040 00041 #ifndef PCSC_API 00042 #define PCSC_API 00043 #endif 00044 00045 #define DEBUGLOG_LOG_ENTRIES 1 00046 #define DEBUGLOG_IGNORE_ENTRIES 2 00047 00048 enum { 00049 DEBUGLOG_NO_DEBUG = 0, 00050 DEBUGLOG_SYSLOG_DEBUG, 00051 DEBUGLOG_STDERR_DEBUG 00052 }; 00053 00054 #define DEBUG_CATEGORY_NOTHING 0 00055 #define DEBUG_CATEGORY_APDU 1 00056 #define DEBUG_CATEGORY_SW 2 00057 00058 enum { 00059 PCSC_LOG_DEBUG = 0, 00060 PCSC_LOG_INFO, 00061 PCSC_LOG_ERROR, 00062 PCSC_LOG_CRITICAL 00063 }; 00064 00065 /* You can't do #ifndef __FUNCTION__ */ 00066 #if !defined(__GNUC__) && !defined(__IBMC__) 00067 #define __FUNCTION__ "" 00068 #endif 00069 00070 #ifdef NO_LOG 00071 00072 #define Log0(priority) do { } while(0) 00073 #define Log1(priority, fmt) do { } while(0) 00074 #define Log2(priority, fmt, data) do { } while(0) 00075 #define Log3(priority, fmt, data1, data2) do { } while(0) 00076 #define Log4(priority, fmt, data1, data2, data3) do { } while(0) 00077 #define Log5(priority, fmt, data1, data2, data3, data4) do { } while(0) 00078 #define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) do { } while(0) 00079 #define LogXxd(priority, msg, buffer, size) do { } while(0) 00080 00081 #define DebugLogA(a) 00082 #define DebugLogB(a, b) 00083 #define DebugLogC(a, b,c) 00084 00085 #else 00086 00087 #define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__) 00088 #define Log1(priority, fmt) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__) 00089 #define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data) 00090 #define Log3(priority, fmt, data1, data2) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2) 00091 #define Log4(priority, fmt, data1, data2, data3) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3) 00092 #define Log5(priority, fmt, data1, data2, data3, data4) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4) 00093 #define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4, data5, data6, data7, data8) 00094 #define LogXxd(priority, msg, buffer, size) log_xxd(priority, msg, buffer, size) 00095 00096 #define DebugLogA(a) Log1(PCSC_LOG_INFO, a) 00097 #define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b) 00098 #define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c) 00099 00100 #endif /* NO_LOG */ 00101 00102 PCSC_API void log_msg(const int priority, const char *fmt, ...); 00103 PCSC_API void log_xxd(const int priority, const char *msg, 00104 const unsigned char *buffer, const int size); 00105 00106 void DebugLogSuppress(const int); 00107 void DebugLogSetLogType(const int); 00108 int DebugLogSetCategory(const int); 00109 void DebugLogCategory(const int, const unsigned char *, const int); 00110 PCSC_API void DebugLogSetLevel(const int level); 00111 00112 #ifdef __cplusplus 00113 } 00114 #endif 00115 00116 #endif /* __debuglog_h__ */ 00117