From da199d1f9920d76bc38e078c8d5fc11d40aadcf6 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 23 Nov 2020 11:40:10 +0100 Subject: [PATCH] Fix dev request logger has been used in production --- IHP/FrameworkConfig.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/IHP/FrameworkConfig.hs b/IHP/FrameworkConfig.hs index 634c9e4a4..f2ec27f71 100644 --- a/IHP/FrameworkConfig.hs +++ b/IHP/FrameworkConfig.hs @@ -10,7 +10,7 @@ import qualified System.Directory as Directory import qualified Data.Text as Text import qualified System.Process as Process import Network.Wai (Middleware) -import qualified Network.Wai.Middleware.RequestLogger as RequestLogger (logStdoutDev) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Web.Cookie as Cookie import Data.Default (def) import Data.Time.Clock (NominalDiffTime) @@ -81,7 +81,11 @@ ihpDefaultConfig = do port <- liftIO defaultAppPort option $ AppPort port - option $ RequestLoggerMiddleware defaultLoggerMiddleware + environment <- findOption @Environment + option $ RequestLoggerMiddleware $ + case environment of + Development -> RequestLogger.logStdoutDev + Production -> RequestLogger.logStdout option $ Sendmail @@ -200,9 +204,6 @@ defaultIHPSessionCookie baseUrl = def data RootApplication = RootApplication deriving (Eq, Show) -defaultLoggerMiddleware :: Middleware -defaultLoggerMiddleware = RequestLogger.logStdoutDev - defaultPort :: Int defaultPort = 8000