1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2009 Index Data
3 * See the file LICENSE for details.
8 #include <yaz/options.h>
14 void hook_func(int level, const char *msg, void *vp)
16 fprintf(stderr, "[HOOK level=%d msg=%s]\n", level, msg);
19 int main(int argc, char **argv)
25 unsigned int wait_between_log = 0;
27 while ((ret = options("f:p:v:l:m:n:r:w:Hh", argv, argc, &arg)) != -2)
32 yaz_log_init_max_size(atoi(arg));
35 yaz_log_time_format(arg);
38 yaz_log_init_prefix(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 [-f logformat] [-v level] [-l file] "
74 "[-p prefix] [-m module] [-w sec] [-r max] [-n num] [-H] msg ..\n");
83 * c-file-style: "Stroustrup"
84 * indent-tabs-mode: nil
86 * vim: shiftwidth=4 tabstop=8 expandtab