[Pcsclite-cvs-commit] r6179 - /trunk/Drivers/ccid/src/debug.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Mon Jan 16 09:24:13 UTC 2012
Author: rousseau
Date: Mon Jan 16 09:24:12 2012
New Revision: 6179
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6179
Log:
Log to stdout by default
This log service is only used on Mac OS X. Using stderr is problematic
when other log mesages are using stdout. The order is not respected if
stdout and stderr are redirected to a file. For example when using
handler_test.
Now the logs are sent to stdout (by default) and also flushed after each
line. It is possible to use tee(1).
Modified:
trunk/Drivers/ccid/src/debug.c
Modified: trunk/Drivers/ccid/src/debug.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/debug.c?rev=6179&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/debug.c (original)
+++ trunk/Drivers/ccid/src/debug.c Mon Jan 16 09:24:12 2012
@@ -30,7 +30,13 @@
#include <string.h>
#include "strlcpycat.h"
-#define LOG_TO_STDERR
+#undef LOG_TO_STDERR
+
+#ifdef LOG_TO_STDERR
+#define LOG_STREAM stderr
+#else
+#define LOG_STREAM stdout
+#endif
void log_msg(const int priority, const char *fmt, ...)
{
@@ -43,9 +49,8 @@
(void)vsnprintf(debug_buffer, sizeof debug_buffer, fmt, argptr);
va_end(argptr);
-#ifdef LOG_TO_STDERR
- (void)fprintf(stderr, "%s\n", debug_buffer);
-#endif
+ (void)fprintf(LOG_STREAM, "%s\n", debug_buffer);
+ fflush(LOG_STREAM);
} /* log_msg */
void log_xxd(const int priority, const char *msg, const unsigned char *buffer,
@@ -67,7 +72,6 @@
c += 3;
}
-#ifdef LOG_TO_STDERR
- (void)fprintf(stderr, "%s\n", debug_buffer);
-#endif
+ (void)fprintf(LOG_STREAM, "%s\n", debug_buffer);
+ fflush(LOG_STREAM);
} /* log_xxd */
More information about the Pcsclite-cvs-commit
mailing list