diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-28 12:50:53 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-28 12:51:57 -0400 |
commit | e833b89e2a1a1c2acbc0eb8bed1760ef0e50f3c5 (patch) | |
tree | 6e29670d7aeb13fc81ba30a68e21813d6ecab470 /Role/Watcher.hs | |
parent | d605fdc0bbed885a003a8c42c53ce3dfadf07c49 (diff) | |
download | debug-me-e833b89e2a1a1c2acbc0eb8bed1760ef0e50f3c5.tar.gz |
log to ~/.debug-me/log/
Make watcher also log and display the name of the logfile at start and
end of session.
--download still downloads to current directory because that seems less
surprising than downloading to elsewhere. Also, the user might want to
keep a copy of the local log while downloading the server log.
Diffstat (limited to 'Role/Watcher.hs')
-rw-r--r-- | Role/Watcher.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Role/Watcher.hs b/Role/Watcher.hs index a4328f8..7b809f0 100644 --- a/Role/Watcher.hs +++ b/Role/Watcher.hs @@ -15,16 +15,17 @@ run :: WatchOpts -> IO () run = run' watcher . watchUrl watcher :: TMVar (TVar DeveloperState) -> TMChan (Message Entered) -> TMChan AnyMessage -> SessionID -> IO () -watcher dsv _ichan ochan _ = inRawMode $ do - (st, startoutput) <- processSessionStart ochan nullLogger dsv +watcher dsv _ichan ochan sid = withSessionLogger sid $ \logger -> inRawMode $ do + (st, startoutput) <- processSessionStart ochan logger dsv emitOutput startoutput - go st + go logger st where - go st = do + go logger st = do ts <- getPOSIXTime v <- atomically $ getServerMessage ochan st ts case v of Nothing -> return () - Just (o, _msg) -> do + Just (o, msg) -> do + _ <- logger msg emitOutput o - go st + go logger st |