From 30d03210f7ac5b12235760f625bac5ff3aa3f85a Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 16 Aug 2023 13:45:40 -0400 Subject: Log and return output to caller The main change here is 'puts' now returns a value, this enables me to collect the value from the conduit source while also doing stuff with it, like printing or logging it as I want. Previously I was running conduit over the source, *and then* kicking off the concurrent processes to wait for the process and collect the output. This would (I think) drain the source before it got to the 'puts' conduit run, and so I wouldn't be able to get the output streamed in real time. It took a lot of refactoring and exploratory programming to get to this relatively-small diff, but now puts works correctly. At least I think it does... it seems to work more reliably from ghci than from the shell. Maybe the shell or TERM is causing nix-store to do some buffering? Maybe I need to use the threaded runtime in GHC? Not sure, but I will look out for this issue and try to identify and fix. Update: yep it was the threaded runtime. I enabled that and now it works in the shell. I squashed that commit into this one. --- Biz/Log.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Biz/Log.hs') diff --git a/Biz/Log.hs b/Biz/Log.hs index a1afd1d..8dba657 100644 --- a/Biz/Log.hs +++ b/Biz/Log.hs @@ -10,6 +10,10 @@ -- -- * don't use `br` after `info`, unless verbose mode is requested (--loud flag in bild) -- +-- * always use `br` after `good`, `fail`, and `pass` +-- +-- * often use `br` after `warn`, unless its really unimportant +-- -- * labels should be roughly hierarchical from general->specific module Biz.Log ( Lvl (..), -- cgit v1.2.3