00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00034 #ifndef __debuglog_h__
00035 #define __debuglog_h__
00036
00037 #ifdef __cplusplus
00038 extern "C"
00039 {
00040 #endif
00041
00042 #ifndef PCSC_API
00043 #define PCSC_API
00044 #endif
00045
00046 #define DEBUGLOG_LOG_ENTRIES 1
00047 #define DEBUGLOG_IGNORE_ENTRIES 2
00048
00049 enum {
00050 DEBUGLOG_NO_DEBUG = 0,
00051 DEBUGLOG_SYSLOG_DEBUG,
00052 DEBUGLOG_STDERR_DEBUG
00053 };
00054
00055 #define DEBUG_CATEGORY_NOTHING 0
00056 #define DEBUG_CATEGORY_APDU 1
00057 #define DEBUG_CATEGORY_SW 2
00058
00059 enum {
00060 PCSC_LOG_DEBUG = 0,
00061 PCSC_LOG_INFO,
00062 PCSC_LOG_ERROR,
00063 PCSC_LOG_CRITICAL
00064 };
00065
00066
00067 #if !defined(__GNUC__) && !defined(__IBMC__)
00068 #define __FUNCTION__ ""
00069 #endif
00070
00071 #define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)
00072 #define Log1(priority, fmt) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__)
00073 #define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data)
00074 #define Log3(priority, fmt, data1, data2) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
00075 #define Log4(priority, fmt, data1, data2, data3) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
00076 #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)
00077 #define LogXxd(priority, msg, buffer, size) log_xxd(priority, msg, buffer, size)
00078
00079 #define DebugLogA(a) Log1(PCSC_LOG_INFO, a)
00080 #define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b)
00081 #define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c)
00082
00083 PCSC_API void log_msg(const int priority, const char *fmt, ...);
00084 PCSC_API void log_xxd(const int priority, const char *msg,
00085 const unsigned char *buffer, const int size);
00086
00087 void DebugLogSuppress(const int);
00088 void DebugLogSetLogType(const int);
00089 int DebugLogSetCategory(const int);
00090 void DebugLogCategory(const int, const unsigned char *, const int);
00091 PCSC_API void DebugLogSetLevel(const int level);
00092
00093 #ifdef __cplusplus
00094 }
00095 #endif
00096
00097 #endif
00098