[Pcsclite-cvs-commit] r5713 - in /trunk/PCSC/src: PCSC/debuglog.h debuglog.c pcscdaemon.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu May 5 09:25:19 UTC 2011
Author: rousseau
Date: Thu May 5 09:25:14 2011
New Revision: 5713
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5713
Log:
Add command line option -T, --color: force use of colored logs
The idea is to have colored logs even if they are redirected to a file
or a pipe.
Modified:
trunk/PCSC/src/PCSC/debuglog.h
trunk/PCSC/src/debuglog.c
trunk/PCSC/src/pcscdaemon.c
Modified: trunk/PCSC/src/PCSC/debuglog.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/PCSC/debuglog.h?rev=5713&op=diff
==============================================================================
--- trunk/PCSC/src/PCSC/debuglog.h (original)
+++ trunk/PCSC/src/PCSC/debuglog.h Thu May 5 09:25:14 2011
@@ -40,7 +40,8 @@
enum {
DEBUGLOG_NO_DEBUG = 0,
DEBUGLOG_SYSLOG_DEBUG,
- DEBUGLOG_STDOUT_DEBUG
+ DEBUGLOG_STDOUT_DEBUG,
+ DEBUGLOG_STDOUT_COLOR_DEBUG
};
#define DEBUG_CATEGORY_NOTHING 0
Modified: trunk/PCSC/src/debuglog.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/debuglog.c?rev=5713&op=diff
==============================================================================
--- trunk/PCSC/src/debuglog.c (original)
+++ trunk/PCSC/src/debuglog.c Thu May 5 09:25:14 2011
@@ -216,6 +216,7 @@
case DEBUGLOG_NO_DEBUG:
case DEBUGLOG_SYSLOG_DEBUG:
case DEBUGLOG_STDOUT_DEBUG:
+ case DEBUGLOG_STDOUT_COLOR_DEBUG:
LogMsgType = dbgtype;
break;
default:
@@ -225,7 +226,8 @@
}
/* log to stdout and stdout is a tty? */
- if (DEBUGLOG_STDOUT_DEBUG == LogMsgType && isatty(fileno(stdout)))
+ if ((DEBUGLOG_STDOUT_DEBUG == LogMsgType && isatty(fileno(stdout)))
+ || (DEBUGLOG_STDOUT_COLOR_DEBUG == LogMsgType))
{
const char *terms[] = { "linux", "xterm", "xterm-color", "Eterm", "rxvt", "rxvt-unicode" };
char *term;
Modified: trunk/PCSC/src/pcscdaemon.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcscdaemon.c?rev=5713&op=diff
==============================================================================
--- trunk/PCSC/src/pcscdaemon.c (original)
+++ trunk/PCSC/src/pcscdaemon.c Thu May 5 09:25:14 2011
@@ -152,6 +152,7 @@
static struct option long_options[] = {
{"config", 1, NULL, 'c'},
{"foreground", 0, NULL, 'f'},
+ {"color", 0, NULL, 'T'},
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'v'},
{"apdu", 0, NULL, 'a'},
@@ -168,7 +169,7 @@
{NULL, 0, NULL, 0}
};
#endif
-#define OPT_STRING "c:fdhvaeCHt:r:s:x"
+#define OPT_STRING "c:fTdhvaeCHt:r:s:x"
newReaderConfig = NULL;
setToForeground = FALSE;
@@ -228,6 +229,11 @@
DebugLogSetLogType(DEBUGLOG_STDOUT_DEBUG);
Log1(PCSC_LOG_INFO,
"pcscd set to foreground with debug send to stdout");
+ break;
+
+ case 'T':
+ DebugLogSetLogType(DEBUGLOG_STDOUT_COLOR_DEBUG);
+ Log1(PCSC_LOG_INFO, "Force colored logs");
break;
case 'd':
@@ -733,6 +739,7 @@
printf(" -c, --config path to reader.conf\n");
printf(" -f, --foreground run in foreground (no daemon),\n");
printf(" send logs to stdout instead of syslog\n");
+ printf(" -T, --color force use of colored logs\n");
printf(" -h, --help display usage information\n");
printf(" -H, --hotplug ask the daemon to rescan the available readers\n");
printf(" -v, --version display the program version number\n");
@@ -748,6 +755,7 @@
printf(" -a log APDU commands and results\n");
printf(" -c path to reader.conf\n");
printf(" -f run in foreground (no daemon), send logs to stdout instead of syslog\n");
+ printf(" -T force use of colored logs\n");
printf(" -d display debug messages. Output may be:\n");
printf(" -h display usage information\n");
printf(" -H ask the daemon to rescan the available readers\n");
More information about the Pcsclite-cvs-commit
mailing list