projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed marc8 flush to deal with sub/sup scripts. Refactor marc-8 page
[yaz-moved-to-github.git]
/
test
/
tstlog.c
diff --git
a/test/tstlog.c
b/test/tstlog.c
index
8bce12f
..
5364b63
100644
(file)
--- a/
test/tstlog.c
+++ b/
test/tstlog.c
@@
-1,25
+1,39
@@
/*
/*
- * Copyright (C) 1995-2005, Index Data ApS
+ * Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
* See the file LICENSE for details.
*
- * $Id: tstlog.c,v 1.5 2005-06-25 15:46:07 adam Exp $
+ * $Id: tstlog.c,v 1.12 2007-01-03 08:42:16 adam Exp $
*
*/
#include <stdio.h>
*
*/
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include <yaz/options.h>
#include <yaz/log.h>
#include <stdlib.h>
#include <yaz/options.h>
#include <yaz/log.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+void hook_func(int level, const char *msg, void *vp)
+{
+ fprintf(stderr, "[HOOK level=%d msg=%s]\n", level, msg);
+}
int main(int argc, char **argv)
{
char *arg;
int main(int argc, char **argv)
{
char *arg;
- int ret;
+ int i, ret;
int level = YLOG_LOG;
int level = YLOG_LOG;
+ int number = 1;
+ unsigned int wait_between_log = 0;
- while ((ret = options("f:v:l:m:", argv, argc, &arg)) != -2)
+ while ((ret = options("f:v:l:m:n:r:w:Hh", argv, argc, &arg)) != -2)
{
switch (ret)
{
{
switch (ret)
{
+ case 'r':
+ yaz_log_init_max_size(atoi(arg));
+ break;
case 'f':
yaz_log_time_format(arg);
break;
case 'f':
yaz_log_time_format(arg);
break;
@@
-27,18
+41,38
@@
int main(int argc, char **argv)
yaz_log_init_level(yaz_log_mask_str(arg));
break;
case 'l':
yaz_log_init_level(yaz_log_mask_str(arg));
break;
case 'l':
- yaz_log_init_file(arg);
+ 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;
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:
case 0:
- yaz_log(level, "%s", arg);
+ 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;
break;
+ case 'h':
default:
fprintf(stderr, "tstlog. Bad option\n");
fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
default:
fprintf(stderr, "tstlog. Bad option\n");
fprintf(stderr, "tstlog [-f logformat] [-v level] [-l file] "
- "[-m module] msg ..\n");
+ "[-m module] [-w sec] [-r max] [-n num] [-H] msg ..\n");
exit(1);
}
}
exit(1);
}
}