[svn] assuan - r326 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Thu Dec 3 19:55:16 CET 2009
Author: marcus
Date: 2009-12-03 19:55:16 +0100 (Thu, 03 Dec 2009)
New Revision: 326
Modified:
trunk/src/ChangeLog
trunk/src/assuan-logging.c
Log:
2009-12-03 Marcus Brinkmann <marcus at g10code.de>
* assuan-logging.c: (log_cats): New static variable.
(TEST_LOG_CAT): New macro.
(_assuan_log_handler): Check log category.
(assuan_set_assuan_log_stream): Check ASSUAN_DEBUG for logging
categories.
(assuan_set_log_stream): Call assuan_set_assuan_log_stream.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2009-12-02 18:35:34 UTC (rev 325)
+++ trunk/src/ChangeLog 2009-12-03 18:55:16 UTC (rev 326)
@@ -1,3 +1,12 @@
+2009-12-03 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-logging.c: (log_cats): New static variable.
+ (TEST_LOG_CAT): New macro.
+ (_assuan_log_handler): Check log category.
+ (assuan_set_assuan_log_stream): Check ASSUAN_DEBUG for logging
+ categories.
+ (assuan_set_log_stream): Call assuan_set_assuan_log_stream.
+
2009-12-02 Marcus Brinkmann <marcus at g10code.de>
* Makefile.am (common_sources): Remove assuan-client.c.
Modified: trunk/src/assuan-logging.c
===================================================================
--- trunk/src/assuan-logging.c 2009-12-02 18:35:34 UTC (rev 325)
+++ trunk/src/assuan-logging.c 2009-12-03 18:55:16 UTC (rev 326)
@@ -44,14 +44,27 @@
logging of buffer data. */
static int full_logging;
+/* A bitfield that specifies the categories to log. Note that
+ assuan-buffer currently does not log through the default handler,
+ but directly. This will be changed later. Then the default here
+ should be to log that and only that. */
+static int log_cats;
+#define TEST_LOG_CAT(x) (!! (log_cats & (1 << (x - 1))))
static FILE *_assuan_log;
void
assuan_set_assuan_log_stream (FILE *fp)
{
+ char *flagstr;
+
_assuan_log = fp;
+
+ /* Set defaults. */
full_logging = !!getenv ("ASSUAN_FULL_LOGGING");
+ flagstr = getenv ("ASSUAN_DEBUG");
+ if (flagstr)
+ log_cats = atoi (flagstr);
}
@@ -65,7 +78,8 @@
if (ctx->log_fp)
fflush (ctx->log_fp);
ctx->log_fp = fp;
- full_logging = !!getenv ("ASSUAN_FULL_LOGGING");
+ if (! _assuan_log)
+ assuan_set_assuan_log_stream (fp);
}
}
@@ -104,8 +118,11 @@
/* For now. */
if (msg == NULL)
- return 1;
+ return TEST_LOG_CAT (cat);
+ if (! TEST_LOG_CAT (cat))
+ return 0;
+
fp = ctx->log_fp ? ctx->log_fp : _assuan_log;
if (!fp)
return 0;
More information about the Gnupg-commits
mailing list