33module Main where
44
55import Control.Monad (void )
6- import Control.Tracer (Tracer (.. ), traceWith )
6+ import Control.Tracer (Tracer (.. ), nullTracer , traceWith )
77
88import Data.Aeson (ToJSON )
99import Data.Act
10+ import Data.Functor.Contravariant ((>$<) )
1011import Data.Void (Void )
11- import Debug.Trace (traceShowM )
1212import Options.Applicative
1313import System.Random (newStdGen , split )
1414
@@ -47,8 +47,10 @@ runDMQ commandLineConfig = do
4747 -- combine default configuration, configuration file and command line
4848 -- options
4949 let dmqConfig@ Configuration {
50- dmqcPrettyLog = I prettyLog,
51- dmqcTopologyFile = I topologyFile
50+ dmqcPrettyLog = I prettyLog,
51+ dmqcTopologyFile = I topologyFile,
52+ dmqcHandshakeTracer = I handshakeTracer,
53+ dmqcLocalHandshakeTracer = I localHandshakeTracer
5254 } = config' <> commandLineConfig
5355 `act`
5456 defaultConfiguration
@@ -78,8 +80,12 @@ runDMQ commandLineConfig = do
7880 dmqLimitsAndTimeouts
7981 defaultSigDecisionPolicy
8082 dmqDiffusionArguments =
81- diffusionArguments debugTracer
82- debugTracer
83+ diffusionArguments (if handshakeTracer
84+ then WithEventType " Handshake" >$< tracer
85+ else nullTracer)
86+ (if localHandshakeTracer
87+ then WithEventType " Handshake" >$< tracer
88+ else nullTracer)
8389 dmqDiffusionApplications =
8490 diffusionApplications nodeKernel
8591 dmqConfig
@@ -92,6 +98,3 @@ runDMQ commandLineConfig = do
9298 (dmqDiffusionTracers dmqConfig tracer)
9399 dmqDiffusionConfiguration
94100 dmqDiffusionApplications
95-
96- debugTracer :: (Show a , Applicative m ) => Tracer m a
97- debugTracer = Tracer traceShowM
0 commit comments