- switch (ret)
- {
- case 'f':
- yaz_log_time_format(arg);
- break;
- case 'v':
- yaz_log_init_level(yaz_log_mask_str(arg));
- break;
- case 'l':
- yaz_log_init_file(arg);
- break;
- case 'm':
- level = yaz_log_module_level(arg);
- break;
- case 0:
- yaz_log(level, "%s", arg);
- break;
- default:
- fprintf(stderr, "tstlog. Bad option\n");
- fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
- "[-m module] msg ..\n");
- exit(1);
- }
+ switch (ret)
+ {
+ case 'r':
+ yaz_log_init_max_size(atoi(arg));
+ break;
+ case 'f':
+ yaz_log_time_format(arg);
+ break;
+ case 'p':
+ yaz_log_init_prefix(arg);
+ break;
+ case 'v':
+ yaz_log_init_level(yaz_log_mask_str(arg));
+ break;
+ case 'l':
+ if (!strcmp(arg, "@"))
+ yaz_log_init_file(0);
+ else
+ yaz_log_init_file(arg);
+ break;
+ case 'n':
+ number = atoi(arg);
+ break;
+ case 'm':
+ level = yaz_log_module_level(arg);
+ break;
+ case 'w':
+ wait_between_log = atoi(arg);
+ break;
+ case 'H':
+ yaz_log_set_handler(hook_func, 0);
+ break;
+ case 0:
+ for (i = 0; i<number; i++)
+ {
+ yaz_log(level, "%d %s", i, arg);
+#if HAVE_UNISTD_H
+ if (wait_between_log)
+ sleep(wait_between_log);
+#endif
+ }
+ break;
+ case 'h':
+ default:
+ fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
+ "[-p prefix] [-m module] [-w sec] [-r max] [-n num] [-H] msg ..\n");
+ exit(1);
+ }