[openib-general] [PATCH] opensm: handle stdout and stderr in osm_log
Sasha Khapyorsky
sashak at voltaire.com
Wed Apr 26 15:15:57 PDT 2006
Hello Hal,
There is small patch for osm_log, this provide possibility to drop log
output to stdout or stderr.
Sasha.
Handle in osm_log "stdout" or "stderr" words as log file names to
indicate logging to stdout or stderr respectively.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
osm/include/opensm/osm_log.h | 6 +++++-
osm/opensm/main.c | 6 +-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/osm/include/opensm/osm_log.h b/osm/include/opensm/osm_log.h
index 8cf8cf1..4a7c08c 100644
--- a/osm/include/opensm/osm_log.h
+++ b/osm/include/opensm/osm_log.h
@@ -224,10 +224,14 @@ osm_log_init(
p_log->level = log_flags;
p_log->flush = flush;
- if (log_file == NULL)
+ if (log_file == NULL || !strcmp(log_file, "stdout"))
{
p_log->out_port = stdout;
}
+ else if (!strcmp(log_file, "stderr"))
+ {
+ p_log->out_port = stderr;
+ }
else
{
if (accum_log_file)
diff --git a/osm/opensm/main.c b/osm/opensm/main.c
index 6f2a857..d95c314 100644
--- a/osm/opensm/main.c
+++ b/osm/opensm/main.c
@@ -722,11 +722,7 @@ #endif
break;
case 'f':
- if (!strcmp(optarg, "stdout"))
- /* output should be to standard output */
- opt.log_file = NULL;
- else
- opt.log_file = optarg;
+ opt.log_file = optarg;
break;
case 'e':
More information about the general
mailing list