2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: tstlog.c,v 1.10 2006-03-21 12:54:02 adam Exp $
11 #include <yaz/options.h>
17 void hook_func(int level, const char *msg, void *vp)
19 fprintf(stderr, "[HOOK level=%d msg=%s]\n", level, msg);
22 int main(int argc, char **argv)
28 unsigned int wait_between_log = 0;
30 while ((ret = options("f:v:l:m:n:s:w:Hh", argv, argc, &arg)) != -2)
35 yaz_log_init_max_size(atoi(arg));
38 yaz_log_time_format(arg);
41 yaz_log_init_level(yaz_log_mask_str(arg));
44 if (!strcmp(arg, "@"))
47 yaz_log_init_file(arg);
53 level = yaz_log_module_level(arg);
56 wait_between_log = atoi(arg);
59 yaz_log_set_handler(hook_func, 0);
62 for (i = 0; i<number; i++)
64 yaz_log(level, "%d %s", i, arg);
67 sleep(wait_between_log);
73 fprintf(stderr, "tstlog. Bad option\n");
74 fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
75 "[-m module] [-w sec] [-s max] [-n num] [-H] msg ..\n");
84 * indent-tabs-mode: nil
86 * vim: shiftwidth=4 tabstop=8 expandtab