on master help sign in
Merge pull request #344 from nikuda/master

Fix for logger Status field being out of place.

commitb122ce50da99b5f130e6b28413715ca530cd8a9f authorMichael Snoyman <michael@snoyman.com> dateWed 4 Mar 2015, 09:06 (12 years ago) parenta9efd010f651ea
1 file changed+8−10
wai-extra/Network/Wai/Middleware/RequestLogger.hs+8−10
wai-extra/Network/Wai/Middleware/RequestLogger.hs+8−10
@@ -229,12 +229,6 @@ detailedMiddleware' cb ansiColor ansiMethod ansiStatusCode app req sendResponse
229229 | otherwise = []
230230 in if null par then [""] else ansiColor White " Params: " <> par <> ["\n"]
231231
232− -- log the request immediately.
233− liftIO $ cb $ mconcat $ map toLogStr $
234− ansiMethod (requestMethod req) ++ [" ", rawPathInfo req, "\n"] ++
235− params ++
236− ansiColor White " Accept: " ++ [accept, "\n"]
237−
238232 t0 <- getCurrentTime
239233 app req' $ \rsp -> do
240234 let isRaw =
@@ -246,10 +240,14 @@ detailedMiddleware' cb ansiColor ansiMethod ansiStatusCode app req sendResponse
246240 t1 <- getCurrentTime
247241
248242 -- log the status of the response
249− unless isRaw $ cb $ mconcat $ map toLogStr $
250− ansiColor White " Status: " ++
251− ansiStatusCode stCode (stCode <> " " <> stMsg) ++
252− [" ", pack $ show $ diffUTCTime t1 t0, "\n"]
243+ cb $ mconcat $ map toLogStr $
244+ ansiMethod (requestMethod req) ++ [" ", rawPathInfo req, "\n"] ++
245+ params ++
246+ ansiColor White " Accept: " ++ [accept, "\n"] ++
247+ if isRaw then [] else
248+ ansiColor White " Status: " ++
249+ ansiStatusCode stCode (stCode <> " " <> stMsg) ++
250+ [" ", pack $ show $ diffUTCTime t1 t0, "\n"]
253251
254252 sendResponse rsp
255253 where