1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Add option whether to include header when logging.

It is useful to be able to exclude the header so that the log file
can be used for realtime input to other programs such as Kst for
plotting live data from sensors.
This commit is contained in:
Jonathan Liu 2018-09-26 20:48:11 +10:00 committed by Simon Tatham
parent 686e78e66b
commit 822d2fd4c3
6 changed files with 17 additions and 1 deletions

View File

@ -1628,6 +1628,9 @@ void setup_config_box(struct controlbox *b, int midsession,
ctrl_checkbox(s, "Flush log file frequently", 'u',
HELPCTX(logging_flush),
conf_checkbox_handler, I(CONF_logflush));
ctrl_checkbox(s, "Include header", 'h',
HELPCTX(logging_header),
conf_checkbox_handler, I(CONF_logheader));
if ((midsession && protocol == PROT_SSH) ||
(!midsession && backend_vt_from_proto(PROT_SSH))) {

View File

@ -246,6 +246,15 @@ warned that the log file may not always be up to date as a result
(although it will of course be flushed when it is closed, for instance
at the end of a session).
\S{config-logheader} \I{log file, header}\q{Include header}
\cfg{winhelp-topic}{logging.header}
This option allows you to choose whether to include a header line
with the date and time when the log file is opened. It may be useful to
disable this if the log file is being used as realtime input to other
programs that don't expect the header line.
\S{config-logssh} Options specific to \i{SSH packet log}ging
These options only apply if SSH packet data is being logged.

View File

@ -103,7 +103,7 @@ static void logfopen_callback(void *vctx, int mode)
}
}
if (ctx->state == L_OPEN) {
if (ctx->state == L_OPEN && conf_get_int(ctx->conf, CONF_logheader)) {
/* Write header line into log file. */
tm = ltime();
strftime(buf, 24, "%Y.%m.%d %H:%M:%S", &tm);

View File

@ -931,6 +931,7 @@ void cleanup_exit(int);
X(INT, NONE, logtype) \
X(INT, NONE, logxfovr) \
X(INT, NONE, logflush) \
X(INT, NONE, logheader) \
X(INT, NONE, logomitpass) \
X(INT, NONE, logomitdata) \
X(INT, NONE, hide_mouseptr) \

View File

@ -524,6 +524,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
write_setting_i(sesskey, "LogType", conf_get_int(conf, CONF_logtype));
write_setting_i(sesskey, "LogFileClash", conf_get_int(conf, CONF_logxfovr));
write_setting_i(sesskey, "LogFlush", conf_get_int(conf, CONF_logflush));
write_setting_i(sesskey, "LogHeader", conf_get_int(conf, CONF_logheader));
write_setting_i(sesskey, "SSHLogOmitPasswords", conf_get_int(conf, CONF_logomitpass));
write_setting_i(sesskey, "SSHLogOmitData", conf_get_int(conf, CONF_logomitdata));
p = "raw";
@ -785,6 +786,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
gppi(sesskey, "LogType", 0, conf, CONF_logtype);
gppi(sesskey, "LogFileClash", LGXF_ASK, conf, CONF_logxfovr);
gppi(sesskey, "LogFlush", 1, conf, CONF_logflush);
gppi(sesskey, "LogHeader", 1, conf, CONF_logheader);
gppi(sesskey, "SSHLogOmitPasswords", 1, conf, CONF_logomitpass);
gppi(sesskey, "SSHLogOmitData", 0, conf, CONF_logomitdata);

View File

@ -23,6 +23,7 @@
#define WINHELP_CTX_logging_filename "logging.filename:config-logfilename"
#define WINHELP_CTX_logging_exists "logging.exists:config-logfileexists"
#define WINHELP_CTX_logging_flush "logging.flush:config-logflush"
#define WINHELP_CTX_logging_header "logging.header:config-logheader"
#define WINHELP_CTX_logging_ssh_omit_password "logging.ssh.omitpassword:config-logssh"
#define WINHELP_CTX_logging_ssh_omit_data "logging.ssh.omitdata:config-logssh"
#define WINHELP_CTX_keyboard_backspace "keyboard.backspace:config-backspace"