From 37913d1986d2d0644670ee4f5c66ebff469c7e06 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 7 Jan 2009 04:12:00 +0000 Subject: [PATCH] Add times to the NSE event messages. --- nse_main.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/nse_main.cc b/nse_main.cc index fdebe8efb..4c774039e 100644 --- a/nse_main.cc +++ b/nse_main.cc @@ -398,18 +398,21 @@ static const char *thread_id_str(const thread_record &thr) { } void log_script_started(const thread_record &thr) { - log_write(LOG_STDOUT, "%s: Starting %s against %s.\n", - SCRIPT_ENGINE, thr.filename.c_str(), thread_id_str(thr)); + log_write(LOG_STDOUT, "%s (%.3fs): Starting %s against %s.\n", + SCRIPT_ENGINE, o.TimeSinceStartMS() / 1000.0, + thr.filename.c_str(), thread_id_str(thr)); } void log_script_finished(const thread_record &thr) { - log_write(LOG_STDOUT, "%s: Finished %s against %s.\n", - SCRIPT_ENGINE, thr.filename.c_str(), thread_id_str(thr)); + log_write(LOG_STDOUT, "%s (%.3fs): Finished %s against %s.\n", + SCRIPT_ENGINE, o.TimeSinceStartMS() / 1000.0, + thr.filename.c_str(), thread_id_str(thr)); } void log_script_timeout(const thread_record &thr) { - log_write(LOG_STDOUT, "%s: Stopped %s against %s because of host timeout.\n", - SCRIPT_ENGINE, thr.filename.c_str(), thread_id_str(thr)); + log_write(LOG_STDOUT, "%s (%.3fs): Stopped %s against %s because of host timeout.\n", + SCRIPT_ENGINE, o.TimeSinceStartMS() / 1000.0, + thr.filename.c_str(), thread_id_str(thr)); } void log_script_error(const thread_record &thr) { @@ -417,8 +420,9 @@ void log_script_error(const thread_record &thr) { /* The error message is what's on top of the stack. */ errmsg = lua_tostring(thr.thread, -1); - log_write(LOG_STDOUT, "%s: %s against %s ended with error: %s\n", - SCRIPT_ENGINE, thr.filename.c_str(), thread_id_str(thr), errmsg); + log_write(LOG_STDOUT, "%s (%.3fs): %s against %s ended with error: %s\n", + SCRIPT_ENGINE, o.TimeSinceStartMS() / 1000.0, + thr.filename.c_str(), thread_id_str(thr), errmsg); } int process_mainloop(lua_State *L) {