pcsc-lite 1.7.2
|
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 5434 2010-12-08 14:13:21Z rousseau $ 00010 */ 00011 00033 #ifndef __debuglog_h__ 00034 #define __debuglog_h__ 00035 00036 #ifndef PCSC_API 00037 #define PCSC_API 00038 #endif 00039 00040 #define DEBUGLOG_LOG_ENTRIES 1 00041 #define DEBUGLOG_IGNORE_ENTRIES 2 00042 00043 enum { 00044 DEBUGLOG_NO_DEBUG = 0, 00045 DEBUGLOG_SYSLOG_DEBUG, 00046 DEBUGLOG_STDERR_DEBUG 00047 }; 00048 00049 #define DEBUG_CATEGORY_NOTHING 0 00050 #define DEBUG_CATEGORY_APDU 1 00051 #define DEBUG_CATEGORY_SW 2 00052 00053 enum { 00054 PCSC_LOG_DEBUG = 0, 00055 PCSC_LOG_INFO, 00056 PCSC_LOG_ERROR, 00057 PCSC_LOG_CRITICAL 00058 }; 00059 00060 /* You can't do #ifndef __FUNCTION__ */ 00061 #if !defined(__GNUC__) && !defined(__IBMC__) 00062 #define __FUNCTION__ "" 00063 #endif 00064 00065 #ifdef NO_LOG 00066 00067 #define Log0(priority) do { } while(0) 00068 #define Log1(priority, fmt) do { } while(0) 00069 #define Log2(priority, fmt, data) do { } while(0) 00070 #define Log3(priority, fmt, data1, data2) do { } while(0) 00071 #define Log4(priority, fmt, data1, data2, data3) do { } while(0) 00072 #define Log5(priority, fmt, data1, data2, data3, data4) do { } while(0) 00073 #define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8) do { } while(0) 00074 #define LogXxd(priority, msg, buffer, size) do { } while(0) 00075 00076 #define DebugLogA(a) 00077 #define DebugLogB(a, b) 00078 #define DebugLogC(a, b,c) 00079 00080 #else 00081 00082 #define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__) 00083 #define Log1(priority, fmt) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__) 00084 #define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data) 00085 #define Log3(priority, fmt, data1, data2) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2) 00086 #define Log4(priority, fmt, data1, data2, data3) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3) 00087 #define Log5(priority, fmt, data1, data2, data3, data4) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4) 00088 #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) 00089 #define LogXxd(priority, msg, buffer, size) log_xxd(priority, msg, buffer, size) 00090 00091 #define DebugLogA(a) Log1(PCSC_LOG_INFO, a) 00092 #define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b) 00093 #define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c) 00094 00095 #endif /* NO_LOG */ 00096 00097 PCSC_API void log_msg(const int priority, const char *fmt, ...); 00098 PCSC_API void log_xxd(const int priority, const char *msg, 00099 const unsigned char *buffer, const int size); 00100 00101 void DebugLogSuppress(const int); 00102 void DebugLogSetLogType(const int); 00103 int DebugLogSetCategory(const int); 00104 void DebugLogCategory(const int, const unsigned char *, const int); 00105 PCSC_API void DebugLogSetLevel(const int level); 00106 00107 #endif /* __debuglog_h__ */ 00108