Abe Crabtree complains that flushing the log file as often as we do in 0.56
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 16 Dec 2004 15:22:36 +0000 (15:22 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 16 Dec 2004 15:22:36 +0000 (15:22 +0000)
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
doc/config.but
putty.h
settings.c
terminal.c
windows/winhelp.h

index 2c0c3b9..08ad490 100644 (file)
--- 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);
                      "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)) {
 
     if ((midsession && protocol == PROT_SSH) ||
        (!midsession && backends[3].name != NULL)) {
index d24aaf1..07c3528 100644 (file)
@@ -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.
 
 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.
 \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 b50058c..f92efea 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -452,6 +452,7 @@ struct config_tag {
     Filename logfilename;
     int logtype;
     int logxfovr;
     Filename logfilename;
     int logtype;
     int logxfovr;
+    int logflush;
     int logomitpass;
     int logomitdata;
     int hide_mouseptr;
     int logomitpass;
     int logomitdata;
     int hide_mouseptr;
index 749760a..4377bfe 100644 (file)
@@ -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_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";
     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);
     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);
 
     gppi(sesskey, "SSHLogOmitPasswords", 1, &cfg->logomitpass);
     gppi(sesskey, "SSHLogOmitData", 0, &cfg->logomitdata);
 
index c6dee33..54f86f8 100644 (file)
@@ -4337,7 +4337,8 @@ static void term_out(Terminal *term)
     }
 
     term_print_flush(term);
     }
 
     term_print_flush(term);
-    logflush(term->logctx);
+    if (term->cfg.logflush)
+       logflush(term->logctx);
 }
 
 /*
 }
 
 /*
index 6701b6c..88338d3 100644 (file)
@@ -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_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"
 #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"