From 71346075c4ad7bee15fe7d6f3067c5b87cfaf146 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 27 Feb 2001 17:02:51 +0000 Subject: [PATCH] Timestamp every line of the Event Log. The primary reason for this (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 | 4 ++-- windlg.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/win_res.rc b/win_res.rc index 6b8a3893..156019d4 100644 --- a/win_res.rc +++ b/win_res.rc @@ -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 */ diff --git a/windlg.c b/windlg.c index f164f3e0..7f994680 100644 --- a/windlg.c +++ b/windlg.c @@ -4,6 +4,7 @@ #include #include #include +#include #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; -- 2.11.0