1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2011 Index Data
3 * See the file LICENSE for details.
12 #include <yaz/options.h>
18 void hook_func(int level, const char *msg, void *vp)
20 fprintf(stderr, "[HOOK level=%d msg=%s]\n", level, msg);
23 int main(int argc, char **argv)
29 unsigned int wait_between_log = 0;
31 while ((ret = options("f:p:v:l:m:n:r:w:Hh", argv, argc, &arg)) != -2)
36 yaz_log_init_max_size(atoi(arg));
39 yaz_log_time_format(arg);
42 yaz_log_init_prefix(arg);
45 yaz_log_init_level(yaz_log_mask_str(arg));
48 if (!strcmp(arg, "@"))
51 yaz_log_init_file(arg);
57 level = yaz_log_module_level(arg);
60 wait_between_log = atoi(arg);
63 yaz_log_set_handler(hook_func, 0);
66 for (i = 0; i<number; i++)
68 yaz_log(level, "%d %s", i, arg);
71 sleep(wait_between_log);
77 fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
78 "[-p prefix] [-m module] [-w sec] [-r max] [-n num] [-H] msg ..\n");
87 * c-file-style: "Stroustrup"
88 * indent-tabs-mode: nil
90 * vim: shiftwidth=4 tabstop=8 expandtab