[Pcsclite-cvs-commit] r1961 - trunk/PCSC/src

Ludovic Rousseau rousseau at costa.debian.org
Tue Mar 21 16:58:42 CET 2006


Author: rousseau
Date: 2006-03-21 15:58:41 +0000 (Tue, 21 Mar 2006)
New Revision: 1961

Modified:
   trunk/PCSC/src/debug.h
Log:
use log_msg() instead of fprintf() for Logx() macro used in libpcsclite
so we can manage priority and color


Modified: trunk/PCSC/src/debug.h
===================================================================
--- trunk/PCSC/src/debug.h	2006-03-21 15:57:38 UTC (rev 1960)
+++ trunk/PCSC/src/debug.h	2006-03-21 15:58:41 UTC (rev 1961)
@@ -44,6 +44,13 @@
 {
 #endif
 
+enum {
+	PCSC_LOG_DEBUG = 0,
+	PCSC_LOG_INFO,
+	PCSC_LOG_ERROR,
+	PCSC_LOG_CRITICAL
+};
+
 #include <stdio.h>
 
 /* You can't do #ifndef __FUNCTION__ */
@@ -51,12 +58,15 @@
 #define __FUNCTION__ ""
 #endif
 
-#define Log0(priority) fprintf(stderr, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)
-#define Log1(priority, fmt) fprintf(stderr, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__)
-#define Log2(priority, fmt, data) fprintf(stderr, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data)
-#define Log3(priority, fmt, data1, data2) fprintf(stderr, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
-#define Log4(priority, fmt, data1, data2, data3) fprintf(stderr, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
+#define Log0(priority) log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)
+#define Log1(priority, fmt) log_msg(priority, "%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)
 
+void log_msg(const int priority, const char *fmt, ...);
+void log_xxd(const int priority, const char *msg,
+	const unsigned char *buffer, const int size);
 
 #ifdef __cplusplus
 }




More information about the Pcsclite-cvs-commit mailing list