[Pkg-gnupg-commit] [libassuan] 271/437: 2009-12-03 Marcus Brinkmann <marcus at g10code.de>

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:33:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit 58ddb0411a61dd3bd77267a1dc9336d5c3c579d5
Author: Marcus Brinkmann <mb at g10code.com>
Date:   Thu Dec 3 18:55:16 2009 +0000

    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.
---
 src/ChangeLog        |  9 +++++++++
 src/assuan-logging.c | 21 +++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 45a849b..fae9d9f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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.
diff --git a/src/assuan-logging.c b/src/assuan-logging.c
index fa2e3c2..5d9d488 100644
--- a/src/assuan-logging.c
+++ b/src/assuan-logging.c
@@ -44,14 +44,27 @@ static char prefix_buffer[80];
    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 @@ assuan_set_log_stream (assuan_context_t ctx, FILE *fp)
       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,7 +118,10 @@ _assuan_log_handler (assuan_context_t ctx, void *hook, unsigned int cat,
 
   /* 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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list