From dde70fa06c7a123f2b4b78a004c2c262a15944ba Mon Sep 17 00:00:00 2001 From: Tony Curtis Date: Fri, 17 Jun 2022 14:36:06 -0400 Subject: [PATCH] Some logging updates --- src/shmemu/logger.c | 9 +++------ src/shmemu/shmemu.h | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/shmemu/logger.c b/src/shmemu/logger.c index bd78e3a..e3d7ab1 100644 --- a/src/shmemu/logger.c +++ b/src/shmemu/logger.c @@ -97,17 +97,15 @@ parse_log_events(void) void shmemu_logger_init(void) { - double wd; - if (! proc.env.logging) { return; } /* TODO "%" modifiers for extra info */ if (proc.env.logging_file != NULL) { - log_stream = fopen(proc.env.logging_file, "a"); + log_stream = fopen(proc.env.logging_file, "w"); if (log_stream == NULL) { - shmemu_fatal(MODULE ": can't append to log file \"%s\"", + shmemu_fatal(MODULE ": can't write to log file \"%s\"", proc.env.logging_file); /* NOT REACHED */ } @@ -117,8 +115,7 @@ shmemu_logger_init(void) } /* how wide to display things */ - wd = ceil(log10((double) proc.li.nranks)); - pe_width = (int) wd; + pe_width = (int) ceil(log10((double) proc.li.nranks)); stamp_width = 30 - pe_width; if (stamp_width < 1) { stamp_width = 1; diff --git a/src/shmemu/shmemu.h b/src/shmemu/shmemu.h index 1936ec1..87170ab 100644 --- a/src/shmemu/shmemu.h +++ b/src/shmemu/shmemu.h @@ -154,7 +154,7 @@ void shmemu_deprecate(const char *fn, const shmemu_version_t *vp); #endif /* ENABLE_LOGGING */ /* - * translate between tread levels and their names + * translate between thread levels and their names */ const char *shmemu_thread_name(int tl);