@@ -1248,9 +1248,8 @@ instance MetaTrace (PeerSelectionActionsTrace SockAddr lAddr) where
12481248-- Connection Manager Tracer
12491249--------------------------------------------------------------------------------
12501250
1251- instance (Show addr , Show versionNumber , Show agreedOptions , LogFormatting addr ,
1252- ToJSON addr , ToJSON versionNumber , ToJSON agreedOptions )
1253- => LogFormatting (ConnectionManager. Trace addr (ConnectionHandlerTrace versionNumber agreedOptions )) where
1251+ instance (Show addr , LogFormatting addr , ToJSON addr , LogFormatting handler , Show handler )
1252+ => LogFormatting (ConnectionManager. Trace addr handler ) where
12541253 forMachine dtal (TrIncludeConnection prov peerAddr) =
12551254 mconcat $ reverse
12561255 [ " kind" .= String " IncludeConnection"
@@ -1299,11 +1298,11 @@ instance (Show addr, Show versionNumber, Show agreedOptions, LogFormatting addr,
12991298 , " provenance" .= String (pack . show $ prov)
13001299 , " remoteAddress" .= forMachine dtal remoteAddress
13011300 ]
1302- forMachine dtal (TrConnectionHandler connId a ) =
1301+ forMachine dtal (TrConnectionHandler connId handler ) =
13031302 mconcat
13041303 [ " kind" .= String " ConnectionHandler"
13051304 , " connectionId" .= toJSON connId
1306- , " connectionHandler" .= forMachine dtal a
1305+ , " connectionHandler" .= forMachine dtal handler
13071306 ]
13081307 forMachine _dtal TrShutdown =
13091308 mconcat
@@ -1442,15 +1441,15 @@ instance (Show versionNumber, ToJSON versionNumber, ToJSON agreedOptions)
14421441 , " command" .= show cerr
14431442 ]
14441443
1445- instance MetaTrace (ConnectionManager. Trace addr
1446- (ConnectionHandlerTrace versionNumber agreedOptions )) where
1444+ instance MetaTrace handler => MetaTrace (ConnectionManager. Trace addr handler ) where
14471445 namespaceFor TrIncludeConnection {} = Namespace [] [" IncludeConnection" ]
14481446 namespaceFor TrReleaseConnection {} = Namespace [] [" UnregisterConnection" ]
14491447 namespaceFor TrConnect {} = Namespace [] [" Connect" ]
14501448 namespaceFor TrConnectError {} = Namespace [] [" ConnectError" ]
14511449 namespaceFor TrTerminatingConnection {} = Namespace [] [" TerminatingConnection" ]
14521450 namespaceFor TrTerminatedConnection {} = Namespace [] [" TerminatedConnection" ]
1453- namespaceFor TrConnectionHandler {} = Namespace [] [" ConnectionHandler" ]
1451+ namespaceFor (TrConnectionHandler _ hdl) =
1452+ nsPrependInner " ConnectionHandler" (namespaceFor hdl)
14541453 namespaceFor TrShutdown {} = Namespace [] [" Shutdown" ]
14551454 namespaceFor TrConnectionExists {} = Namespace [] [" ConnectionExists" ]
14561455 namespaceFor TrForbiddenConnection {} = Namespace [] [" ForbiddenConnection" ]
@@ -1472,17 +1471,8 @@ instance MetaTrace (ConnectionManager.Trace addr
14721471 severityFor (Namespace _ [" ConnectError" ]) _ = Just Info
14731472 severityFor (Namespace _ [" TerminatingConnection" ]) _ = Just Debug
14741473 severityFor (Namespace _ [" TerminatedConnection" ]) _ = Just Debug
1475- severityFor (Namespace _ [" ConnectionHandler" ])
1476- (Just (TrConnectionHandler _ ev')) = Just $
1477- case ev' of
1478- TrHandshakeSuccess {} -> Info
1479- TrHandshakeQuery {} -> Info
1480- TrHandshakeClientError {} -> Notice
1481- TrHandshakeServerError {} -> Info
1482- TrConnectionHandlerError _ _ ShutdownNode -> Critical
1483- TrConnectionHandlerError _ _ ShutdownPeer -> Info
1484- severityFor (Namespace _ [" ConnectionHandler" ]) _ = Just Info
1485- severityFor (Namespace _ [" ConnectionHandler" ]) Nothing = Just Info
1474+ severityFor (Namespace out (" ConnectionHandler" : tl)) (Just (TrConnectionHandler _ hdl)) =
1475+ severityFor (Namespace out tl) (Just hdl)
14861476 severityFor (Namespace _ [" Shutdown" ]) _ = Just Info
14871477 severityFor (Namespace _ [" ConnectionExists" ]) _ = Just Info
14881478 severityFor (Namespace _ [" ForbiddenConnection" ]) _ = Just Info
@@ -1504,7 +1494,8 @@ instance MetaTrace (ConnectionManager.Trace addr
15041494 documentFor (Namespace _ [" ConnectError" ]) = Just " "
15051495 documentFor (Namespace _ [" TerminatingConnection" ]) = Just " "
15061496 documentFor (Namespace _ [" TerminatedConnection" ]) = Just " "
1507- documentFor (Namespace _ [" ConnectionHandler" ]) = Just " "
1497+ documentFor (Namespace out (" ConnectionHandler" : tl)) =
1498+ documentFor (Namespace out tl :: Namespace handler )
15081499 documentFor (Namespace _ [" Shutdown" ]) = Just " "
15091500 documentFor (Namespace _ [" ConnectionExists" ]) = Just " "
15101501 documentFor (Namespace _ [" ForbiddenConnection" ]) = Just " "
@@ -1537,7 +1528,6 @@ instance MetaTrace (ConnectionManager.Trace addr
15371528 , Namespace [] [" ConnectError" ]
15381529 , Namespace [] [" TerminatingConnection" ]
15391530 , Namespace [] [" TerminatedConnection" ]
1540- , Namespace [] [" ConnectionHandler" ]
15411531 , Namespace [] [" Shutdown" ]
15421532 , Namespace [] [" ConnectionExists" ]
15431533 , Namespace [] [" ForbiddenConnection" ]
@@ -1550,8 +1540,40 @@ instance MetaTrace (ConnectionManager.Trace addr
15501540 , Namespace [] [" ConnectionTimeWaitDone" ]
15511541 , Namespace [] [" ConnectionManagerCounters" ]
15521542 , Namespace [] [" State" ]
1553- , Namespace [] [" UnexpectedlyFalseAssertion" ]
1554- ]
1543+ , Namespace [] [" UnexpectedlyFalseAssertion" ]]
1544+ ++ map (nsPrependInner " ConnectionHandler" )
1545+ (allNamespaces :: [Namespace handler ])
1546+
1547+
1548+ instance MetaTrace (ConnectionHandlerTrace versionNumber agreedOptions ) where
1549+ namespaceFor TrHandshakeSuccess {} = Namespace [] [" HandshakeSuccess" ]
1550+ namespaceFor TrHandshakeQuery {} = Namespace [] [" HandshakeQuery" ]
1551+ namespaceFor TrHandshakeClientError {} = Namespace [] [" HandshakeClientError" ]
1552+ namespaceFor TrHandshakeServerError {} = Namespace [] [" HandshakeServerError" ]
1553+ namespaceFor TrConnectionHandlerError {} = Namespace [] [" Error" ]
1554+
1555+ severityFor (Namespace _ [" HandshakeSuccess" ]) _ = Just Info
1556+ severityFor (Namespace _ [" HandshakeQuery" ]) _ = Just Info
1557+ severityFor (Namespace _ [" HandshakeClientError" ]) _ = Just Notice
1558+ severityFor (Namespace _ [" HandshakeServerError" ]) _ = Just Info
1559+ severityFor (Namespace _ [" Error" ]) (Just (TrConnectionHandlerError _ _ ShutdownNode )) = Just Critical
1560+ severityFor (Namespace _ [" Error" ]) (Just (TrConnectionHandlerError _ _ ShutdownPeer )) = Just Info
1561+ severityFor _ _ = Nothing
1562+
1563+ documentFor (Namespace _ [" HandshakeSuccess" ]) = Just " "
1564+ documentFor (Namespace _ [" HandshakeQuery" ]) = Just " "
1565+ documentFor (Namespace _ [" HandshakeClientError" ]) = Just " "
1566+ documentFor (Namespace _ [" HandshakeServerError" ]) = Just " "
1567+ documentFor (Namespace _ [" Error" ]) = Just " "
1568+ documentFor _ = Nothing
1569+
1570+ allNamespaces = [
1571+ Namespace [] [" HandshakeSuccess" ]
1572+ , Namespace [] [" HandshakeQuery" ]
1573+ , Namespace [] [" HandshakeClientError" ]
1574+ , Namespace [] [" HandshakeServerError" ]
1575+ , Namespace [] [" Error" ]
1576+ ]
15551577
15561578--------------------------------------------------------------------------------
15571579-- Connection Manager Transition Tracer
0 commit comments