From 2cced0fc9668eedb5fb19d721ed4aa4c3f9ed371 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 4 Apr 2006 00:02:34 +0000 Subject: [PATCH] For testlib programs argv[1] holds log level (if given). argv[2] holds log format (if given). Also testlib start up routine deletes (empties) the log file. --- test/api/testlib.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/api/testlib.c b/test/api/testlib.c index fe1ecc1..3eb6918 100644 --- a/test/api/testlib.c +++ b/test/api/testlib.c @@ -1,4 +1,4 @@ -/* $Id: testlib.c,v 1.30 2006-03-31 15:58:05 adam Exp $ +/* $Id: testlib.c,v 1.31 2006-04-04 00:02:34 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -51,10 +51,14 @@ void tl_start_log(int argc, char **argv) if (!argv[0]) return; sprintf(logname, "%s.log", argv[0]); +#if HAVE_UNISTD_H + unlink(logname); +#endif yaz_log_init_file(logname); - log_level = yaz_log_mask_str_x(argv[0], 0); if (argc >= 2) - cmd_level |= yaz_log_mask_str_x(argv[1], 0); + log_level = yaz_log_mask_str_x(argv[1], 0); + if (argc >= 3) + yaz_log_time_format(argv[2]); yaz_log_init_level(YLOG_DEFAULT_LEVEL | log_level | cmd_level); yaz_log(log_level, "starting %s", argv[0]); } -- 1.7.10.4