[Pcsclite-cvs-commit] CVS PCSC/src/PCSC
CVS User rousseau
ludovic.rousseau@free.fr
Tue, 22 Feb 2005 07:20:19 -0700
Update of /cvsroot/pcsclite/PCSC/src/PCSC
In directory haydn:/tmp/cvs-serv7021/PCSC
Modified Files:
debuglog.h
Log Message:
use Log1(priority, fmt) instead of DebugLogA(fmt) to add a priority
level so that pcscd log verbosity is dynamic
We define DebugLogA(a) as Log1(PCSC_LOG_INFO, a) for backward source
code compatibility
--- /cvsroot/pcsclite/PCSC/src/PCSC/debuglog.h 2004/07/29 20:40:07 1.13
+++ /cvsroot/pcsclite/PCSC/src/PCSC/debuglog.h 2005/02/22 14:20:19 1.14
@@ -7,7 +7,7 @@
* David Corcoran <corcoran@linuxnet.com>
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
- * $Id: debuglog.h,v 1.13 2004/07/29 20:40:07 rousseau Exp $
+ * $Id: debuglog.h,v 1.14 2005/02/22 14:20:19 rousseau Exp $
*/
/*
@@ -52,30 +52,36 @@
#define DEBUG_CATEGORY_APDU 1
#define DEBUG_CATEGORY_SW 2
+enum {
+ PCSC_LOG_DEBUG = 0,
+ PCSC_LOG_INFO,
+ PCSC_LOG_ERROR,
+ PCSC_LOG_CRITICAL
+};
+
/* You can't do #ifndef __FUNCTION__ */
#if !defined(__GNUC__) && !defined(__IBMC__)
#define __FUNCTION__ ""
#endif
-#ifndef NO_PCSC_DEBUG
-#define DebugLogA(fmt) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
-#define DebugLogB(fmt, data) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
-#define DebugLogC(fmt, data1, data2) debug_msg("%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
-#define DebugXxd(msg, buffer, size) debug_xxd(msg, buffer, size)
-#else
-#define DebugLogA(fmt)
-#define DebugLogB(fmt, data)
-#define DebugLogC(fmt, data1, data2)
-#define DebugXxd(msg, buffer, size)
-#endif
-
-void debug_msg(const char *fmt, ...);
-void debug_xxd(const char *msg, const unsigned char *buffer, const int size);
+#define Log1(priority, fmt) log_msg(priority, "i%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__)
+#define Log2(priority, fmt, data) log_msg(priority, "%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data)
+#define Log3(priority, fmt, data1, data2) log_msg(priority, "%s:%d:%s " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
+#define LogXxd(priority, msg, buffer, size) log_xxd(priority, msg, buffer, size)
+
+#define DebugLogA(a) Log1(PCSC_LOG_INFO, a)
+#define DebugLogB(a, b) Log2(PCSC_LOG_INFO, a, b)
+#define DebugLogC(a, b,c) Log3(PCSC_LOG_INFO, a, b, c)
+
+void log_msg(int priority, const char *fmt, ...);
+void log_xxd(int priority, const char *msg, const unsigned char *buffer,
+ const int size);
void DebugLogSuppress(const int);
void DebugLogSetLogType(const int);
int DebugLogSetCategory(const int);
void DebugLogCategory(const int, const unsigned char *, const int);
+void DebugLogSetLevel(const int level);
char *pcsc_stringify_error(long);