From 364a4433cd10b4785caef708ebacb4925c101b4d Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Tue, 4 Aug 2020 17:55:01 -0600 Subject: [PATCH] line buffering for journald --- src/Application.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Application.hs b/src/Application.hs index c53fa1a..3c0829c 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -43,6 +43,7 @@ import Network.Wai.Middleware.Cors (CorsResourcePolicy (..), import Network.Wai.Middleware.MethodOverride import Network.Wai.Middleware.RequestLogger (Destination (Logger), IPAddrSource (..), OutputFormat (..), destination, mkRequestLogger, outputFormat) +import System.IO (hSetBuffering, BufferMode (..)) import System.Log.FastLogger (defaultBufSize, newStdoutLoggerSet, toLogStr) import Yesod.Core import Yesod.Core.Types hiding (Logger) @@ -162,6 +163,7 @@ getAppSettings = loadYamlSettings [configSettingsYml] [] useEnv -- | The @main@ function for an executable running this site. appMain :: IO () appMain = do + hSetBuffering stdout LineBuffering -- Get the settings from all relevant sources settings <- loadYamlSettingsArgs -- fall back to compile-time values, set to [] to require values at runtime