-/* $Id: testlib.c,v 1.3 2004-10-29 13:02:39 heikki Exp $
+/* $Id: testlib.c,v 1.5 2004-11-19 10:27:15 heikki Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
/** testlib - utilities for the api tests */
#include <assert.h>
-#include <yaz/log.h>
#include <yaz/pquery.h>
#include <idzebra/api.h>
#include "testlib.h"
/** start_log: open a log file */
/* FIXME - parse command line arguments to set log levels etc */
+int log_level=0; /* not static, t*.c may use it */
+
void start_log(int argc, char **argv)
{
char logname[2048];
return;
sprintf(logname, "%s.log", argv[0]);
yaz_log_init_file(logname);
+ log_level = yaz_log_mask_str_x(argv[0],0);
+ yaz_log_init_level(YLOG_DEFAULT_LEVEL | log_level);
+ yaz_log(log_level,"starting %s",argv[0]);
}
/**
zebra_stop(zs);
if (retcode)
- logf(LOG_LOG,"========= Exiting with return code %d", retcode);
+ yaz_log(log_level,"========= Exiting with return code %d", retcode);
else
- logf(LOG_LOG,"========= All tests OK");
+ yaz_log(log_level,"========= All tests OK");
nmem_exit();
xmalloc_trav("x");
return retcode;
char *addinfo;
assert(zh);
zebra_select_database(zh, "Default");
- logf(LOG_LOG,"going to call init");
+ yaz_log(log_level,"going to call init");
i=zebra_init(zh);
- logf(LOG_LOG,"init returned %d",i);
+ yaz_log(log_level,"init returned %d",i);
if (i)
{
printf("init failed with %d\n",i);
int rc;
- logf(LOG_LOG,"======================================");
- logf(LOG_LOG,"qry[%d]: %s", lineno, query);
+ yaz_log(log_level,"======================================");
+ yaz_log(log_level,"qry[%d]: %s", lineno, query);
odr=odr_createmem (ODR_DECODE);
parser = yaz_pqf_create();