summaryrefslogtreecommitdiffhomepage
path: root/Replay.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-22 11:41:54 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-22 11:41:54 -0400
commit362d3a437c16c10d221caeac21e9f685d7ddf3e6 (patch)
tree89e8ca2a63bebd6355c4d6b163592e538ba2eced /Replay.hs
parentdb4e4c47898c0bb3dab27ee82ca563e37aaf62ea (diff)
downloaddebug-me-362d3a437c16c10d221caeac21e9f685d7ddf3e6.tar.gz
stream the log
avoid processing it in memory, and allow parse errors at end to not prevent displaying part of it
Diffstat (limited to 'Replay.hs')
-rw-r--r--Replay.hs5
1 files changed, 3 insertions, 2 deletions
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