Flush the logfile reasonably frequently in `printable output only' and
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 12 Aug 2004 01:02:01 +0000 (01:02 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Thu, 12 Aug 2004 01:02:01 +0000 (01:02 +0000)
`all session data' modes, without completely mauling the performance, by
fflush()ing once per term_out(). If anyone complains I suppose we can
make this optional.

git-svn-id: svn://svn.tartarus.org/sgt/putty@4445 cda61777-01e9-0310-a592-d414129be87e

logging.c
putty.h
terminal.c

index f32e9ca..5302998 100644 (file)
--- a/logging.c
+++ b/logging.c
@@ -35,6 +35,16 @@ void logtraffic(void *handle, unsigned char c, int logmode)
 }
 
 /*
+ * Flush any open log file.
+ */
+void logflush(void *handle) {
+    struct LogContext *ctx = (struct LogContext *)handle;
+    if (ctx->cfg.logtype > 0)
+       if (ctx->lgfp)
+           fflush(ctx->lgfp);
+}
+
+/*
  * Log an Event Log entry. Used in SSH packet logging mode; this is
  * also as convenient a place as any to put the output of Event Log
  * entries to stderr when a command-line tool is in verbose mode.
diff --git a/putty.h b/putty.h
index 6d4d83a..3fb26bc 100644 (file)
--- a/putty.h
+++ b/putty.h
@@ -655,6 +655,7 @@ void log_reconfig(void *logctx, Config *cfg);
 void logfopen(void *logctx);
 void logfclose(void *logctx);
 void logtraffic(void *logctx, unsigned char c, int logmode);
+void logflush(void *logctx);
 void log_eventlog(void *logctx, const char *string);
 enum { PKT_INCOMING, PKT_OUTGOING };
 void log_packet(void *logctx, int direction, int type,
index bf531ee..00fd7c8 100644 (file)
@@ -3311,6 +3311,7 @@ void term_out(Terminal *term)
     }
 
     term_print_flush(term);
+    logflush(term->logctx);
 }
 
 #if 0