Skip to content

Commit

Permalink
Merge #1415
Browse files Browse the repository at this point in the history
1415: stdoutTextTracer: Use line-buffered print statements r=KtorZ a=rvl

### Issue number

Found while reviewing #1394.

### Summary

Use `B8.putStrLn`, which seems to be line-buffered, whereas `T.putStrLn` is character-buffered.

So rather than

    Starting ntp client
    quernyt pt oc lnitepn tc liise nttr iigngveorkeedd

we get

    Starting ntp client
    query to ntp client invoked
    ntp client is triggered



Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
  • Loading branch information
iohk-bors[bot] and rvl authored Mar 6, 2020
2 parents ed11146 + b0e72cf commit f2c0389
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/core/src/Cardano/Wallet/Logging.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import Data.Text
import Data.Text.Class
( ToText (..) )

import qualified Data.Text.IO as T
import qualified Data.ByteString.Char8 as B8
import qualified Data.Text.Encoding as T

-- | Converts a 'Text' trace into any other type of trace that has a 'ToText'
-- instance.
Expand Down Expand Up @@ -125,4 +126,4 @@ filterNonEmpty tr = Tracer $ \arg -> do
-- | Creates a tracer that prints any 'ToText' log message. This is useful for
-- debugging functions in the REPL, when you need a 'Tracer' object.
stdoutTextTracer :: (MonadIO m, ToText a) => Tracer m a
stdoutTextTracer = Tracer $ liftIO . T.putStrLn . toText
stdoutTextTracer = Tracer $ liftIO . B8.putStrLn . T.encodeUtf8 . toText

0 comments on commit f2c0389

Please sign in to comment.