From 77d012e69a40cd41f8d8bb9cdc674291d816b345 Mon Sep 17 00:00:00 2001 From: haskal Date: Mon, 23 Nov 2020 03:21:41 -0500 Subject: [PATCH] flush output when logging --- crossfire/logging.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crossfire/logging.rkt b/crossfire/logging.rkt index f83f298..8200f75 100644 --- a/crossfire/logging.rkt +++ b/crossfire/logging.rkt @@ -57,11 +57,13 @@ [_ "<7>"])) ;; in UTC - (define time-str (date->string (seconds->date (* 0.001 (current-inexact-milliseconds)) #f) #t)) + (define time-str + (date->string (seconds->date (* 0.001 (current-inexact-milliseconds)) #f) #t)) ;; prefix each line of the log entry with the metadata (define msg-lines (string-split msg "\n")) (for ([line (in-list msg-lines)]) - (printf "~a[~aZ] [~a] ~a\n" prefix-str time-str level-str line)))) + (printf "~a[~aZ] [~a] ~a\n" prefix-str time-str level-str line) + (flush-output (current-output-port))))) ;; process log entries until told to stop ;; this uses the same technique as with-intercepted-logging