2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: tstlog.c,v 1.9 2006-03-21 12:32:16 adam Exp $
10 #include <yaz/options.h>
16 void hook_func(int level, const char *msg, void *vp)
18 fprintf(stderr, "[HOOK level=%d msg=%s]\n", level, msg);
21 int main(int argc, char **argv)
27 unsigned int wait_between_log = 0;
29 while ((ret = options("f:v:l:m:n:s:w:Hh", argv, argc, &arg)) != -2)
34 yaz_log_init_max_size(atoi(arg));
37 yaz_log_time_format(arg);
40 yaz_log_init_level(yaz_log_mask_str(arg));
43 if (!strcmp(arg, "@"))
46 yaz_log_init_file(arg);
52 level = yaz_log_module_level(arg);
55 wait_between_log = atoi(arg);
58 log_event_start(hook_func, 0);
61 for (i = 0; i<number; i++)
63 yaz_log(level, "%d %s", i, arg);
66 sleep(wait_between_log);
72 fprintf(stderr, "tstlog. Bad option\n");
73 fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
74 "[-m module] [-w sec] [-s max] [-n num] [-H] msg ..\n");
83 * indent-tabs-mode: nil
85 * vim: shiftwidth=4 tabstop=8 expandtab