on master help sign in
Fix for logger Status field being out of place.
commit0f651eaefc42f4d59c29127c8eb669d15ac974b7 authorAnte Salinovic <antes@qti.qualcomm.com> dateTue 3 Mar 2015, 12:00 (12 years ago) parenta9efd01
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