Commits

Stefan Saasen  committed 3cce374

Remove comments, debug statement, eta reduce 'trim'

  • Participants
  • Parent commits 8cc5f42

Comments (0)

Files changed (2)

File logparser/src/Stash/Log/Input.hs

 module Stash.Log.Input
 ( sortLogFiles
 , readFiles
-, FileInfo(..)
 , extractFileInfo
 , isFileNewer
 , filterLastDay
 , dropUntilDate
 , readLogFiles
+, FileInfo(..)
 , RunConfig(..)
 , newRunConfig
 ) where
 import Data.Time.Calendar
 import Text.Printf (printf)
 import System.Directory (renameFile, doesFileExist)
-import Debug.Trace
 
 data FileInfo = FileInfo {
      year       :: String
 -- | Read the list of files and turn them into a lazy ByteString. The input files will be
 -- filtered using the function (FilePath -> Bool)
 readFiles :: [FilePath] -> IO L.ByteString
-readFiles files = trace ("filteredFiles: " ++ show filteredFiles)  fmap L.concat . mapM readCompressedOrUncompressed $ filteredFiles
-            where filteredFiles = sortLogFiles files
+readFiles files = fmap L.concat . mapM readCompressedOrUncompressed $ sortLogFiles files
 
 filterLastDay :: [FilePath] -> [FilePath]
 filterLastDay []    = []
             updatedConfig   = M.insert key now' conf
         content             <- toLines (if progressive && isJust date then dropUntilDate (fromJust date) $ filterLastDay path else path)
         _                   <- saveConfig updatedConfig
-        return $ trace ("date: " ++ show date ++ " key: " ++ key ++ " now: " ++ now') content
+        return content
         where
             configFile          = "logparser.state"
             temp                = configFile ++ ".tmp"

File logparser/src/Stash/Log/Parser.hs

 import Data.String.Utils (split)
 import Data.Maybe (mapMaybe)
 import Text.Printf (printf)
--- REMOTE_ADRESS | PROTOCOL | (o|i)REQUEST_ID | USERNAME | date |  URL | DETAILS | LABELS | TIME | SESSION_ID |
--- REQUEST_ID -> MINUTE_OF_DAYxREQUEST_COUNTERxCONCURRENT_REQUESTS
 
 type Input = [L.ByteString]
 
 
 -- | Remove leading and trailing whitespace
 trim :: String -> String
-trim str = T.unpack $ T.strip $ T.pack str
-
-{-
-Example log line
-- 63.246.22.198,172.16.3.45 | https | o16x1402216x7 | cbac-confluence-user | 2012-09-08 00:17:00,270 | "GET /scm/ATLASSIAN/confluence.git/info/refs HTTP/1.1" | "" "JGit/unknown" | - | 1506 | - |
-
-Example log line after upgrading the clone cache plugin
-63.246.22.198,172.16.1.187 | https | o1116x10425x4 | cbac-confluence-user | 2012-10-10 18:36:02,078 | "GET /scm/ATLASSIAN/confluence.git/info/refs HTTP/1.1" | "" "JGit/unknown" | refs, cache:hit | 315 | s5ecvn |
--}
+trim = T.unpack . T.strip . T.pack