00001
00002
00003
00004
00005
00006
00007
00008
00009
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
00066 #if !defined(__GNUC__) && !defined(__IBMC__)
00067 #define __FUNCTION__ ""
00068 #endif
00069
00070 #define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)
00071 #define Log1(priority, fmt) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__)
00072 #define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data)
00073 #define Log3(priority, fmt, data1, data2) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
00074 #define Log4(priority, fmt, data1, data2, data3) log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
00075 #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)
00076 #define LogXxd(priority, msg, buffer, size) log_xxd(priority, msg, buffer, size)
00077
00078 #define DebugLogA(a) Log1(PCSC_LOG_INFO, a)
00079 #define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b)
00080 #define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c)
00081
00082 PCSC_API void log_msg(const int priority, const char *fmt, ...);
00083 PCSC_API void log_xxd(const int priority, const char *msg,
00084 const unsigned char *buffer, const int size);
00085
00086 void DebugLogSuppress(const int);
00087 void DebugLogSetLogType(const int);
00088 int DebugLogSetCategory(const int);
00089 void DebugLogCategory(const int, const unsigned char *, const int);
00090 PCSC_API void DebugLogSetLevel(const int level);
00091
00092 #ifdef __cplusplus
00093 }
00094 #endif
00095
00096 #endif
00097