Skip to content

Commit

Permalink
Use the ToTextTracer in local-cluster exe
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed May 8, 2024
1 parent 258d922 commit eb48aaa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
23 changes: 13 additions & 10 deletions lib/local-cluster/exe/local-cluster.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import Prelude
import Cardano.Address.Style.Shelley
( shelleyTestnet
)
import Cardano.BM.Extra
( stdoutTextTracer
import Cardano.BM.ToTextTracer
( ToTextTracer (..)
, newToTextTracer
)
import Cardano.Launcher.Node
( nodeSocketFile
Expand Down Expand Up @@ -71,11 +72,7 @@ import Control.Monad.IO.Class
( MonadIO (..)
)
import Control.Tracer
( Tracer (..)
, traceWith
)
import Data.Text.Class
( ToText
( traceWith
)
import Main.Utf8
( withUtf8
Expand Down Expand Up @@ -232,8 +229,7 @@ main = withUtf8 $ do
setDefaultFilePermissions

skipCleanup <- SkipCleanup <$> isEnvSet "NO_CLEANUP"
let tr :: ToText a => Tracer IO a
tr = stdoutTextTracer

clusterEra <- Cluster.clusterEraFromEnv
cfgNodeLogging <-
Cluster.logFileConfigFromEnv
Expand All @@ -249,6 +245,13 @@ main = withUtf8 $ do
} <-
parseCommandLineOptions
evalContT $ do
-- Add a tracer for the cluster logs
ToTextTracer tr <-
ContT
$ newToTextTracer
(toFilePath . absFileOf <$> clusterLogs)
Nothing

-- Create a temporary directory for the cluster
clusterPath <-
case clusterDir of
Expand All @@ -266,7 +269,7 @@ main = withUtf8 $ do
, cfgClusterConfigs = clusterConfigsDir
, cfgTestnetMagic = Cluster.TestnetMagic 42
, cfgShelleyGenesisMods = [over #sgSlotLength \_ -> 0.2]
, cfgTracer = stdoutTextTracer
, cfgTracer = tr
, cfgNodeOutputFile = Nothing
, cfgRelayNodePath = mkRelDirOf "relay"
, cfgClusterLogFile = clusterLogs
Expand Down
1 change: 0 additions & 1 deletion lib/local-cluster/local-cluster.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ executable local-cluster
, mtl
, pathtype
, temporary-extra
, text-class
, unliftio
, with-utf8

Expand Down

0 comments on commit eb48aaa

Please sign in to comment.