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.

[originally from svn r956]
This commit is contained in:
Simon Tatham 2001-02-27 17:02:51 +00:00
Родитель 2b8ab6082f
Коммит 0d3ab7306e
2 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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;