Fix build with wai 0.3.0.
This version of wai changed the type of Middleware, so I cannot seem to liftIO inside it. So, got rid of a lot of not really needed complexity to use System.Log.Logger's logging stuff, and just use the standard wai stdout logger when debug logging is enabled. Format may change some, and it logs http to stdout instead of stderr now. Doesn't matter for the webapp since both go to the same log anyway.
This commit is contained in:
parent
2d142b4368
commit
8ff9938d97
5 changed files with 12 additions and 36 deletions
|
@ -47,6 +47,8 @@ import Yesod
|
|||
import Network.Socket (SockAddr, HostName)
|
||||
import Data.Text (pack, unpack)
|
||||
import qualified Network.Wai.Handler.WarpTLS as TLS
|
||||
import Network.Wai.Middleware.RequestLogger
|
||||
import System.Log.Logger
|
||||
|
||||
mkYesodDispatch "WebApp" $(parseRoutesFile "Assistant/WebApp/routes")
|
||||
|
||||
|
@ -83,7 +85,7 @@ webAppThread assistantdata urlrenderer noannex cannotrun postfirstrun listenhost
|
|||
setUrlRenderer urlrenderer $ yesodRender webapp (pack "")
|
||||
app <- toWaiAppPlain webapp
|
||||
app' <- ifM debugEnabled
|
||||
( return $ httpDebugLogger app
|
||||
( return $ logStdout app
|
||||
, return app
|
||||
)
|
||||
runWebApp tlssettings listenhost' app' $ \addr -> if noannex
|
||||
|
@ -135,3 +137,9 @@ getTlsSettings = do
|
|||
#else
|
||||
return Nothing
|
||||
#endif
|
||||
|
||||
{- Checks if debugging is actually enabled. -}
|
||||
debugEnabled :: IO Bool
|
||||
debugEnabled = do
|
||||
l <- getRootLogger
|
||||
return $ getLevel l <= Just DEBUG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue