]> granicus.if.org Git - postgis/commitdiff
Register a debug logger for unit tester
authorSandro Santilli <strk@keybit.net>
Wed, 15 Jun 2016 16:31:09 +0000 (16:31 +0000)
committerSandro Santilli <strk@keybit.net>
Wed, 15 Jun 2016 16:31:09 +0000 (16:31 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@14954 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_tester.c

index d1098c9c93a3a2a6710adb372c15be05250b8b1e..7f266d5a70ee06839aa96a7962c5e139dcc9bb1c 100644 (file)
@@ -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()
 {