From 176e4bcaa974aa659ecb2ec15b278a7122b07a41 Mon Sep 17 00:00:00 2001 From: Yuanle Song Date: Tue, 8 Sep 2015 10:18:59 +0800 Subject: [PATCH] add a guideline for --top param's output --- src/Main.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index df2cbf1..0ccea9a 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -173,7 +173,9 @@ countRequests logs = go Map.empty logs where -- | print a top URLs report for user. -- list m is ordered by view count DESC. prettyPrintFrequentRequests :: Int -> [(RequestPair, Int)] -> IO () -prettyPrintFrequentRequests totalRequestCount m = mapM_ ppLine m where +prettyPrintFrequentRequests totalRequestCount m = do + putStrLn "== most frequently accessed URLs ==" + mapM_ ppLine m where ppLine :: (RequestPair, Int) -> IO () ppLine ((verb, path), count) = do let percentage = (fromIntegral count :: Double) * 100.0 / (fromIntegral totalRequestCount :: Double) -- GitLab