From 362d3a437c16c10d221caeac21e9f685d7ddf3e6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Apr 2017 11:41:54 -0400 Subject: stream the log avoid processing it in memory, and allow parse errors at end to not prevent displaying part of it --- Replay.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Replay.hs') diff --git a/Replay.hs b/Replay.hs index b13012d..9612d5b 100644 --- a/Replay.hs +++ b/Replay.hs @@ -10,10 +10,10 @@ import System.IO import Control.Concurrent.Thread.Delay replay :: ReplayOpts -> IO () -replay opts = go Nothing =<< loadLog (replayLogFile opts) +replay opts = go Nothing =<< streamLog (replayLogFile opts) where go _ [] = sessionDone - go prevts (l:ls) = do + go prevts (Right l:ls) = do case prevts of Nothing -> return () Just t -> @@ -28,3 +28,4 @@ replay opts = go Nothing =<< loadLog (replayLogFile opts) User (ControlMessage _) -> return () Developer _ -> return () go (Just $ loggedTimestamp l) ls + go _ (Left l:_) = error $ "Failed to parse a line of the log: " ++ l -- cgit v1.2.3