From 6d60c7915f26898fb4468096ffbf9ddc843db73a Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 16 Dec 2004 15:22:36 +0000 Subject: [PATCH] Abe Crabtree complains that flushing the log file as often as we do in 0.56 results in unacceptable performance for him on Win2000. Add a checkbox to revert to the old behaviour. git-svn-id: svn://svn.tartarus.org/sgt/putty@4988 cda61777-01e9-0310-a592-d414129be87e --- config.c | 3 +++ doc/config.but | 16 ++++++++++++++++ putty.h | 1 + settings.c | 2 ++ terminal.c | 3 ++- windows/winhelp.h | 1 + 6 files changed, 25 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index 2c0c3b95..08ad4900 100644 --- a/config.c +++ b/config.c @@ -885,6 +885,9 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist, "Always overwrite it", I(LGXF_OVR), "Always append to the end of it", I(LGXF_APN), "Ask the user every time", I(LGXF_ASK), NULL); + ctrl_checkbox(s, "Flush log file frequently", 'u', + HELPCTX(logging_flush), + dlg_stdcheckbox_handler, I(offsetof(Config,logflush))); if ((midsession && protocol == PROT_SSH) || (!midsession && backends[3].name != NULL)) { diff --git a/doc/config.but b/doc/config.but index d24aaf17..07c35289 100644 --- a/doc/config.but +++ b/doc/config.but @@ -206,6 +206,22 @@ Finally (the default option), you might not want to have any automatic behaviour, but to ask the user every time the problem comes up. +\S{config-logflush} \q{Flush log file frequently} + +\cfg{winhelp-topic}{logging.flush} + +This option allows you to control how frequently logged data is +flushed to disc. By default, PuTTY will flush data as soon as it is +displayed, so that if you view the log file while a session is still +open, it will be up to date; and if the client system crashes, there's +a greater chance that the data will be preserved. + +However, this can incur a performance penalty. If PuTTY is running +slowly with logging enabled, you could try unchecking this option. Be +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-logssh} Options specific to SSH packet logging These options only apply if SSH packet data is being logged. diff --git a/putty.h b/putty.h index b50058c3..f92efea3 100644 --- a/putty.h +++ b/putty.h @@ -452,6 +452,7 @@ struct config_tag { Filename logfilename; int logtype; int logxfovr; + int logflush; int logomitpass; int logomitdata; int hide_mouseptr; diff --git a/settings.c b/settings.c index 749760a8..4377bfe3 100644 --- a/settings.c +++ b/settings.c @@ -167,6 +167,7 @@ void save_open_settings(void *sesskey, int do_host, Config *cfg) write_setting_filename(sesskey, "LogFileName", cfg->logfilename); write_setting_i(sesskey, "LogType", cfg->logtype); write_setting_i(sesskey, "LogFileClash", cfg->logxfovr); + write_setting_i(sesskey, "LogFlush", cfg->logflush); write_setting_i(sesskey, "SSHLogOmitPasswords", cfg->logomitpass); write_setting_i(sesskey, "SSHLogOmitData", cfg->logomitdata); p = "raw"; @@ -395,6 +396,7 @@ void load_open_settings(void *sesskey, int do_host, Config *cfg) gppfile(sesskey, "LogFileName", &cfg->logfilename); gppi(sesskey, "LogType", 0, &cfg->logtype); gppi(sesskey, "LogFileClash", LGXF_ASK, &cfg->logxfovr); + gppi(sesskey, "LogFlush", 1, &cfg->logflush); gppi(sesskey, "SSHLogOmitPasswords", 1, &cfg->logomitpass); gppi(sesskey, "SSHLogOmitData", 0, &cfg->logomitdata); diff --git a/terminal.c b/terminal.c index c6dee33f..54f86f86 100644 --- a/terminal.c +++ b/terminal.c @@ -4337,7 +4337,8 @@ static void term_out(Terminal *term) } term_print_flush(term); - logflush(term->logctx); + if (term->cfg.logflush) + logflush(term->logctx); } /* diff --git a/windows/winhelp.h b/windows/winhelp.h index 6701b6c3..88338d3a 100644 --- a/windows/winhelp.h +++ b/windows/winhelp.h @@ -13,6 +13,7 @@ #define WINHELP_CTX_logging_main "logging.main" #define WINHELP_CTX_logging_filename "logging.filename" #define WINHELP_CTX_logging_exists "logging.exists" +#define WINHELP_CTX_logging_flush "logging.flush" #define WINHELP_CTX_logging_ssh_omit_password "logging.ssh.omitpassword" #define WINHELP_CTX_logging_ssh_omit_data "logging.ssh.omitdata" #define WINHELP_CTX_keyboard_backspace "keyboard.backspace" -- 2.11.0