From: Sandro Santilli Date: Wed, 15 Jun 2016 16:31:09 +0000 (+0000) Subject: Register a debug logger for unit tester X-Git-Tag: 2.3.0beta1~76 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c5d18960cef70c2ad59493cbc1586fce80ebbe98;p=postgis Register a debug logger for unit tester git-svn-id: http://svn.osgeo.org/postgis/trunk@14954 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_tester.c b/liblwgeom/cunit/cu_tester.c index d1098c9c9..7f266d5a7 100644 --- a/liblwgeom/cunit/cu_tester.c +++ b/liblwgeom/cunit/cu_tester.c @@ -23,6 +23,9 @@ cu_errorreporter(const char *fmt, va_list ap); static void cu_noticereporter(const char *fmt, va_list ap); +static void +cu_debuglogger(int level, const char *fmt, va_list ap); + /* ADD YOUR SUITE SETUP FUNCTION HERE (1 of 2) */ extern void print_suite_setup(); @@ -140,6 +143,7 @@ int main(int argc, char *argv[]) /* Install the custom error handler */ lwgeom_set_handlers(0, 0, 0, cu_errorreporter, cu_noticereporter); + lwgeom_set_debuglogger(cu_debuglogger); /* Initialize the CUnit test registry */ if (CUE_SUCCESS != CU_initialize_registry()) @@ -273,6 +277,15 @@ cu_noticereporter(const char *fmt, va_list ap) /*fprintf(stderr, "NOTICE: %s\n", buf);*/ } +static void +cu_debuglogger(int level, const char *fmt, va_list ap) +{ + char buf[MAX_CUNIT_MSG_LENGTH+1]; + vsnprintf (buf, MAX_CUNIT_MSG_LENGTH, fmt, ap); + buf[MAX_CUNIT_MSG_LENGTH]='\0'; + fprintf(stderr, "DEBUG%d: %s\n", level, buf); +} + void cu_error_msg_reset() {