From a4bdecdc7d17a3fa705db4e1c3360590f836cb5d Mon Sep 17 00:00:00 2001 From: maggie Date: Fri, 11 Oct 2019 11:14:26 +0200 Subject: [PATCH] Flush io buffer after each write to log (#554) --- src/kemal/log_handler.cr | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/kemal/log_handler.cr b/src/kemal/log_handler.cr index fe902f2..ce08e57 100644 --- a/src/kemal/log_handler.cr +++ b/src/kemal/log_handler.cr @@ -8,11 +8,14 @@ module Kemal elapsed_time = Time.measure { call_next(context) } elapsed_text = elapsed_text(elapsed_time) @io << Time.utc << ' ' << context.response.status_code << ' ' << context.request.method << ' ' << context.request.resource << ' ' << elapsed_text << '\n' + @io.flush context end def write(message : String) @io << message + @io.flush + @io end private def elapsed_text(elapsed)