2 * Copyright (C) 1995-2007, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: tstlog.c,v 1.14 2007-06-05 06:40:28 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:p:v:l:m:n:r:w:Hh", argv, argc, &arg)) != -2)
35 yaz_log_init_max_size(atoi(arg));
38 yaz_log_time_format(arg);
41 yaz_log_init_prefix(arg);
44 yaz_log_init_level(yaz_log_mask_str(arg));
47 if (!strcmp(arg, "@"))
50 yaz_log_init_file(arg);
56 level = yaz_log_module_level(arg);
59 wait_between_log = atoi(arg);
62 yaz_log_set_handler(hook_func, 0);
65 for (i = 0; i<number; i++)
67 yaz_log(level, "%d %s", i, arg);
70 sleep(wait_between_log);
76 fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
77 "[-p prefix] [-m module] [-w sec] [-r max] [-n num] [-H] msg ..\n");
86 * indent-tabs-mode: nil
88 * vim: shiftwidth=4 tabstop=8 expandtab