Timestamp every line of the Event Log. The primary reason for this
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 27 Feb 2001 17:02:51 +0000 (17:02 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 27 Feb 2001 17:02:51 +0000 (17:02 +0000)
(generating detail in bug reports when SSH2 repeat key exchange
failed) is no longer an issue, but it might be useful for other
things. It's a _log_ dammit, and logs should be timestamped.

git-svn-id: svn://svn.tartarus.org/sgt/putty@956 cda61777-01e9-0310-a592-d414129be87e

win_res.rc
windlg.c

index 6b8a389..156019d 100644 (file)
@@ -52,14 +52,14 @@ BEGIN
 END
 
 /* Accelerators used: co */
-IDD_LOGBOX DIALOG DISCARDABLE 100, 20, 260, 119
+IDD_LOGBOX DIALOG DISCARDABLE 100, 20, 300, 119
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "PuTTY Event Log"
 FONT 8, "MS Sans Serif"
 BEGIN
     DEFPUSHBUTTON "&Close", IDOK, 135, 102, 44, 14
     PUSHBUTTON "C&opy", IDN_COPY, 81, 102, 44, 14
-    LISTBOX IDN_LIST, 3, 3, 254, 95, LBS_HASSTRINGS | LBS_USETABSTOPS | WS_VSCROLL | LBS_EXTENDEDSEL
+    LISTBOX IDN_LIST, 3, 3, 294, 95, LBS_HASSTRINGS | LBS_USETABSTOPS | WS_VSCROLL | LBS_EXTENDEDSEL
 END
 
 /* No accelerators used */
index f164f3e..7f99468 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <time.h>
 
 #include "ssh.h"
 #include "putty.h"
@@ -2038,12 +2039,20 @@ int do_reconfig (HWND hwnd) {
 }
 
 void logevent (char *string) {
+    char timebuf[40];
+    time_t t;
+
     if (nevents >= negsize) {
        negsize += 64;
        events = srealloc (events, negsize * sizeof(*events));
     }
-    events[nevents] = smalloc(1+strlen(string));
-    strcpy (events[nevents], string);
+
+    time(&t);
+    strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S    ", localtime(&t));
+
+    events[nevents] = smalloc(strlen(timebuf)+strlen(string)+1);
+    strcpy(events[nevents], timebuf);
+    strcat(events[nevents], string);
     nevents++;
     if (logbox) {
         int count;