diff options
author | Ben Sima <ben@bsima.me> | 2023-08-16 13:45:40 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-08-16 18:24:05 -0400 |
commit | 30d03210f7ac5b12235760f625bac5ff3aa3f85a (patch) | |
tree | 09cc458e1e4e884d126b21ee03a7a95a7ae3451f /Biz/Log.hs | |
parent | 5c214478cc2d9e78ba78f3911f9fede2029c829f (diff) |
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.
Diffstat (limited to 'Biz/Log.hs')
-rw-r--r-- | Biz/Log.hs | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 (..), |