@@ -98,60 +98,60 @@ decodeAndProcess l =
98
98
Left e -> P. error $ " Decoding failed" <> show e <> " for line: " <> line
99
99
Right decoded -> lift $ processLogs decoded
100
100
101
- -- | Ideally we would have Data instances for all types so we could get data type String representation
102
- -- instead of providing strings but that would add some compilation time overhead so not worth it.
101
+ -- | Ideally we would have Data instances for all types so we could get data type string representation
102
+ -- instead of providing strings directly but that would add some compilation time overhead so not worth it.
103
103
processLogs :: Envelope (HydraLog Tx ) -> IO (Decoded Tx )
104
104
processLogs decoded =
105
105
case decoded. message of
106
- NodeOptions opt -> logIt NodeOptionsLabel ( show opt)
106
+ NodeOptions opt -> logIt NodeOptionsLabel opt
107
107
Node msg ->
108
108
case msg of
109
109
BeginInput {input} ->
110
110
case input of
111
- ClientInput {clientInput} -> logIt ClientSentLabel ( show clientInput)
111
+ ClientInput {clientInput} -> logIt ClientSentLabel clientInput
112
112
NetworkInput {} -> pure DropLog
113
113
ChainInput {chainEvent} ->
114
114
case chainEvent of
115
- Observation {observedTx} -> logIt ObservationLabel ( show observedTx)
115
+ Observation {observedTx} -> logIt ObservationLabel observedTx
116
116
Rollback {} -> pure DropLog
117
117
Tick {} -> pure DropLog
118
- PostTxError {postTxError} -> logIt ErrorLabel ( show postTxError)
118
+ PostTxError {postTxError} -> logIt ErrorLabel postTxError
119
119
EndInput {} -> pure DropLog
120
120
BeginEffect {effect} ->
121
121
case effect of
122
122
ClientEffect {} -> pure DropLog
123
- NetworkEffect {message} -> logIt NetworkLabel ( show message)
124
- OnChainEffect {postChainTx} -> logIt ChainEffectLabel ( show postChainTx)
123
+ NetworkEffect {message} -> logIt NetworkLabel message
124
+ OnChainEffect {postChainTx} -> logIt ChainEffectLabel postChainTx
125
125
EndEffect {} -> pure DropLog
126
126
LogicOutcome {outcome} ->
127
127
case outcome of
128
128
Continue {stateChanges} ->
129
129
foldM
130
130
( \ _ a -> case a of
131
- HeadInitialized {} -> logIt (LogicLabel " HeadInitialized" ) " "
132
- HeadOpened {} -> logIt (LogicLabel " HeadOpened" ) " "
133
- CommittedUTxO {} -> logIt (LogicLabel " CommittedUTxO" ) " "
134
- HeadAborted {} -> logIt (LogicLabel " HeadAborted" ) " "
135
- SnapshotRequestDecided {} -> logIt (LogicLabel " SnapshotRequestDecided" ) " "
136
- SnapshotRequested {} -> logIt (LogicLabel " SnapshotRequested" ) " "
137
- PartySignedSnapshot {} -> logIt (LogicLabel " PartySignedSnapshot" ) " "
138
- SnapshotConfirmed {} -> logIt (LogicLabel " SnapshotConfirmed" ) " "
139
- DepositRecorded {} -> logIt (LogicLabel " DepositRecorded" ) " "
140
- DepositActivated {} -> logIt (LogicLabel " DepositActivated" ) " "
141
- DepositExpired {} -> logIt (LogicLabel " DepositExpired" ) " "
142
- DepositRecovered {} -> logIt (LogicLabel " DepositRecovered" ) " "
143
- CommitApproved {} -> logIt (LogicLabel " CommitApproved" ) " "
144
- CommitFinalized {} -> logIt (LogicLabel " CommitFinalized" ) " "
145
- DecommitRecorded {} -> logIt (LogicLabel " DecommitRecorded" ) " "
146
- DecommitApproved {} -> logIt (LogicLabel " DecommitApproved" ) " "
147
- DecommitInvalid {} -> logIt (LogicLabel " DecommitInvalid" ) " "
148
- DecommitFinalized {} -> logIt (LogicLabel " DecommitFinalized" ) " "
149
- HeadClosed {} -> logIt (LogicLabel " HeadClosed" ) " "
150
- HeadContested {} -> logIt (LogicLabel " HeadContested" ) " "
151
- HeadIsReadyToFanout {} -> logIt (LogicLabel " HeadIsReadyToFanout" ) " "
152
- HeadFannedOut {} -> logIt (LogicLabel " HeadFannedOut" ) " "
153
- IgnoredHeadInitializing {} -> logIt (LogicLabel " IgnoredHeadInitializing" ) " "
154
- TxInvalid {} -> logIt (LogicLabel " TxInvalid" ) " "
131
+ details @ HeadInitialized {} -> logIt (LogicLabel " HeadInitialized" ) details
132
+ details @ HeadOpened {} -> logIt (LogicLabel " HeadOpened" ) details
133
+ details @ CommittedUTxO {} -> logIt (LogicLabel " CommittedUTxO" ) details
134
+ details @ HeadAborted {} -> logIt (LogicLabel " HeadAborted" ) details
135
+ details @ SnapshotRequestDecided {} -> logIt (LogicLabel " SnapshotRequestDecided" ) details
136
+ details @ SnapshotRequested {} -> logIt (LogicLabel " SnapshotRequested" ) details
137
+ details @ PartySignedSnapshot {} -> logIt (LogicLabel " PartySignedSnapshot" ) details
138
+ details @ SnapshotConfirmed {} -> logIt (LogicLabel " SnapshotConfirmed" ) details
139
+ details @ DepositRecorded {} -> logIt (LogicLabel " DepositRecorded" ) details
140
+ details @ DepositActivated {} -> logIt (LogicLabel " DepositActivated" ) details
141
+ details @ DepositExpired {} -> logIt (LogicLabel " DepositExpired" ) details
142
+ details @ DepositRecovered {} -> logIt (LogicLabel " DepositRecovered" ) details
143
+ details @ CommitApproved {} -> logIt (LogicLabel " CommitApproved" ) details
144
+ details @ CommitFinalized {} -> logIt (LogicLabel " CommitFinalized" ) details
145
+ details @ DecommitRecorded {} -> logIt (LogicLabel " DecommitRecorded" ) details
146
+ details @ DecommitApproved {} -> logIt (LogicLabel " DecommitApproved" ) details
147
+ details @ DecommitInvalid {} -> logIt (LogicLabel " DecommitInvalid" ) details
148
+ details @ DecommitFinalized {} -> logIt (LogicLabel " DecommitFinalized" ) details
149
+ details @ HeadClosed {} -> logIt (LogicLabel " HeadClosed" ) details
150
+ details @ HeadContested {} -> logIt (LogicLabel " HeadContested" ) details
151
+ details @ HeadIsReadyToFanout {} -> logIt (LogicLabel " HeadIsReadyToFanout" ) details
152
+ details @ HeadFannedOut {} -> logIt (LogicLabel " HeadFannedOut" ) details
153
+ details @ IgnoredHeadInitializing {} -> logIt (LogicLabel " IgnoredHeadInitializing" ) details
154
+ details @ TxInvalid {} -> logIt (LogicLabel " TxInvalid" ) details
155
155
NetworkConnected {} -> pure DropLog
156
156
NetworkDisconnected {} -> pure DropLog
157
157
PeerConnected {} -> pure DropLog
@@ -168,17 +168,17 @@ processLogs decoded =
168
168
DropLog
169
169
stateChanges
170
170
Wait {} -> pure DropLog
171
- Error {error = err} -> logIt (LogicError " LOGIC ERROR" ) ( show err)
171
+ Error {error = err} -> logIt (LogicError " LOGIC ERROR" ) err
172
172
DroppedFromQueue {} -> pure DropLog
173
- LoadingState -> logIt (Other " Loading state..." ) " "
174
- LoadedState {} -> logIt (Other " Loaded." ) " "
175
- ReplayingState -> logIt (Other " Replaying state..." ) " "
176
- Misconfiguration {} -> logIt (Other " MISCONFIG!" ) " "
173
+ LoadingState -> logIt (Other " Loading state..." ) ()
174
+ LoadedState {} -> logIt (Other " Loaded." ) ()
175
+ ReplayingState -> logIt (Other " Replaying state..." ) ()
176
+ details @ Misconfiguration {} -> logIt (Other " MISCONFIG!" ) details
177
177
_ -> pure DropLog
178
178
where
179
- logIt :: LogType -> Text -> IO (Decoded Tx )
179
+ logIt :: Show x => LogType -> x -> IO (Decoded Tx )
180
180
logIt l s =
181
- pure $ DecodedHydraLog decoded. timestamp decoded. namespace (InfoLine l s )
181
+ pure $ DecodedHydraLog decoded. timestamp decoded. namespace (InfoLine l ( show s) )
182
182
183
183
render :: Decoded tx -> IO ()
184
184
render = \ case
0 commit comments