Skip to content

Commit

Permalink
Demote process output to Debug severity (#348)
Browse files Browse the repository at this point in the history
* Demote process output to Debug severity

This is perhaps a more controversial change. The process output is quite
noisy, and arguably not of interest unless you're debugging an issue.

The counterargument is that if something *does* go wrong with running the
cradle command, it's useful to see it. Perhaps we could collect the
output and only emit it on failure?

* Use a special constructor for process output
  • Loading branch information
michaelpj committed May 7, 2022
1 parent ff5f3fd commit 6f61038
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/HIE/Bios/Cradle.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ readProcessWithOutputs outputNames l workDir cp = flip runContT return $ do

-- Windows line endings are not converted so you have to filter out `'r` characters
let loggingConduit = C.decodeUtf8 C..| C.lines C..| C.filterE (/= '\r')
C..| C.map T.unpack C..| C.iterM (\msg -> l <& LogAny msg `WithSeverity` Info) C..| C.sinkList
C..| C.map T.unpack C..| C.iterM (\msg -> l <& LogProcessOutput msg `WithSeverity` Debug) C..| C.sinkList
(ex, stdo, stde) <- liftIO $ sourceProcessWithStreams process mempty loggingConduit loggingConduit

res <- forM output_files $ \(name,path) ->
Expand Down
4 changes: 3 additions & 1 deletion src/HIE/Bios/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ data ActionName a
| Other a
deriving (Show, Eq, Ord, Functor)

data Log = LogAny String
data Log =
LogAny String
| LogProcessOutput String
deriving Show

instance Pretty Log where
Expand Down

0 comments on commit 6f61038

Please sign in to comment.