dovecot-2.0-pigeonhole: Testsuite: added info log output to -E c...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Wed Feb 9 20:32:35 EET 2011


details:   http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/c4ff3b2c21e3
changeset: 1470:c4ff3b2c21e3
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Wed Feb 09 19:29:43 2011 +0100
description:
Testsuite: added info log output to -E command line option.

diffstat:

 src/testsuite/testsuite-log.c |  29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diffs (60 lines):

diff -r dcaa91e4c7e5 -r c4ff3b2c21e3 src/testsuite/testsuite-log.c
--- a/src/testsuite/testsuite-log.c	Wed Jan 26 00:51:55 2011 +0100
+++ b/src/testsuite/testsuite-log.c	Wed Feb 09 19:29:43 2011 +0100
@@ -33,6 +33,7 @@
 static pool_t _testsuite_logmsg_pool = NULL;
 ARRAY_DEFINE(_testsuite_log_errors, struct _testsuite_log_message);
 ARRAY_DEFINE(_testsuite_log_warnings, struct _testsuite_log_message);
+ARRAY_DEFINE(_testsuite_log_messages, struct _testsuite_log_message);
 
 static void _testsuite_log_verror
 (struct sieve_error_handler *ehandler ATTR_UNUSED,
@@ -99,6 +100,32 @@
 	array_append(&_testsuite_log_warnings, &msg, 1);
 }
 
+static void _testsuite_log_vinfo
+(struct sieve_error_handler *ehandler ATTR_UNUSED,
+	unsigned int flags ATTR_UNUSED, const char *location, const char *fmt,
+	va_list args)
+{
+	pool_t pool = _testsuite_logmsg_pool;
+	struct _testsuite_log_message msg;
+
+	if ( _testsuite_log_stdout ) {
+		va_list args_copy;
+		VA_COPY(args_copy, args);
+
+		if ( location == NULL || *location == '\0' )
+			fprintf(stdout,
+				"LOG: warning: %s.\n", t_strdup_vprintf(fmt, args_copy));
+		else
+			fprintf(stdout,
+				"LOG: warning: %s: %s.\n", location, t_strdup_vprintf(fmt, args_copy));
+	}
+
+	msg.location = p_strdup(pool, location);
+	msg.message = p_strdup_vprintf(pool, fmt, args);
+
+	array_append(&_testsuite_log_messages, &msg, 1);
+}
+
 static struct sieve_error_handler *_testsuite_log_ehandler_create(void)
 {
 	pool_t pool;
@@ -111,6 +138,7 @@
 
 	ehandler->verror = _testsuite_log_verror;
 	ehandler->vwarning = _testsuite_log_vwarning;
+	ehandler->vinfo = _testsuite_log_vinfo;
 
 	return ehandler;
 }
@@ -148,6 +176,7 @@
 
 	p_array_init(&_testsuite_log_errors, _testsuite_logmsg_pool, 128);
 	p_array_init(&_testsuite_log_warnings, _testsuite_logmsg_pool, 128);
+	p_array_init(&_testsuite_log_messages, _testsuite_logmsg_pool, 128);
 
 	sieve_error_handler_reset(testsuite_log_ehandler);
 }


More information about the dovecot-cvs mailing list