From 5c46220e721069f8b8ac43a7ec006a599a8d33f0 Mon Sep 17 00:00:00 2001 From: Lorenzo Delgado Date: Tue, 6 Dec 2022 14:54:03 +0100 Subject: [PATCH] add eth topic to all the logs scope (#568) --- eth/net/nat.nim | 2 +- eth/p2p.nim | 4 ++++ eth/p2p/discovery.nim | 2 +- eth/p2p/discoveryv5/encoding.nim | 2 +- eth/p2p/discoveryv5/protocol.nim | 2 +- eth/p2p/kademlia.nim | 2 +- eth/p2p/peer_pool.nim | 4 ++++ eth/p2p/rlpx.nim | 2 +- eth/utp/utp_discv5_protocol.nim | 2 +- eth/utp/utp_protocol.nim | 2 +- eth/utp/utp_router.nim | 2 +- eth/utp/utp_socket.nim | 2 +- 12 files changed, 18 insertions(+), 10 deletions(-) diff --git a/eth/net/nat.nim b/eth/net/nat.nim index e1aa790..ead32ee 100644 --- a/eth/net/nat.nim +++ b/eth/net/nat.nim @@ -45,7 +45,7 @@ var externalUdpPort: Port logScope: - topics = "nat" + topics = "eth net nat" ## Also does threadvar initialisation. ## Must be called before redirectPorts() in each thread. diff --git a/eth/p2p.nim b/eth/p2p.nim index 8d1ced7..0d7277c 100644 --- a/eth/p2p.nim +++ b/eth/p2p.nim @@ -16,6 +16,10 @@ import export p2p_types, rlpx, enode, kademlia +logScope: + topics = "eth p2p" + + proc addCapability*(node: var EthereumNode, p: ProtocolInfo, networkState: RootRef = nil) = diff --git a/eth/p2p/discovery.nim b/eth/p2p/discovery.nim index 2c49128..44ed4a9 100644 --- a/eth/p2p/discovery.nim +++ b/eth/p2p/discovery.nim @@ -18,7 +18,7 @@ export Node, results logScope: - topics = "discovery" + topics = "eth p2p discovery" const # UDP packet constants. diff --git a/eth/p2p/discoveryv5/encoding.nim b/eth/p2p/discoveryv5/encoding.nim index ffa9d0f..f414249 100644 --- a/eth/p2p/discoveryv5/encoding.nim +++ b/eth/p2p/discoveryv5/encoding.nim @@ -29,7 +29,7 @@ declareCounter discovery_session_lru_cache_misses, "Session LRU cache misses" declareCounter discovery_session_decrypt_failures, "Session decrypt failures" logScope: - topics = "discv5" + topics = "eth p2p discv5" # Support overriding the default discv5 protocol version and protocol id # via compile time defines (e.g., '-d:discv5_protocol_id=d5waku') diff --git a/eth/p2p/discoveryv5/protocol.nim b/eth/p2p/discoveryv5/protocol.nim index fd1a747..bb6aa59 100644 --- a/eth/p2p/discoveryv5/protocol.nim +++ b/eth/p2p/discoveryv5/protocol.nim @@ -101,7 +101,7 @@ declareCounter discovery_enr_auto_update, "Amount of discovery IP:port address ENR auto updates" logScope: - topics = "discv5" + topics = "eth p2p discv5" const alpha = 3 ## Kademlia concurrency factor diff --git a/eth/p2p/kademlia.nim b/eth/p2p/kademlia.nim index 774b91a..3496cf3 100644 --- a/eth/p2p/kademlia.nim +++ b/eth/p2p/kademlia.nim @@ -16,7 +16,7 @@ import export sets # TODO: This should not be needed, but compilation fails otherwise logScope: - topics = "kademlia" + topics = "eth p2p kademlia" type # 32 bytes NodeId | 16 bytes ip | 1 byte mode diff --git a/eth/p2p/peer_pool.nim b/eth/p2p/peer_pool.nim index 714c2bd..6158191 100644 --- a/eth/p2p/peer_pool.nim +++ b/eth/p2p/peer_pool.nim @@ -16,6 +16,10 @@ import ".."/[keys, common], ./private/p2p_types, "."/[discovery, kademlia, rlpx, enode] +logScope: + topics = "eth p2p peer_pool" + + const lookupInterval = 5 connectLoopSleep = chronos.milliseconds(2000) diff --git a/eth/p2p/rlpx.nim b/eth/p2p/rlpx.nim index f4fec40..e5cc9fe 100644 --- a/eth/p2p/rlpx.nim +++ b/eth/p2p/rlpx.nim @@ -37,7 +37,7 @@ export declarePublicGauge connected_peers, "number of peers in the pool" logScope: - topics = "rlpx" + topics = "eth p2p rlpx" type ResponderWithId*[MsgType] = object diff --git a/eth/utp/utp_discv5_protocol.nim b/eth/utp/utp_discv5_protocol.nim index 863d450..57126b3 100644 --- a/eth/utp/utp_discv5_protocol.nim +++ b/eth/utp/utp_discv5_protocol.nim @@ -16,7 +16,7 @@ import export utp_router, protocol logScope: - topics = "utp_discv5_protocol" + topics = "eth utp utp_discv5_protocol" type NodeAddress* = object diff --git a/eth/utp/utp_protocol.nim b/eth/utp/utp_protocol.nim index 44a726c..2fc4df6 100644 --- a/eth/utp/utp_protocol.nim +++ b/eth/utp/utp_protocol.nim @@ -13,7 +13,7 @@ import ../keys logScope: - topics = "utp" + topics = "eth utp" type # For now utp protocol is tied to udp transport, but ultimately we would like to diff --git a/eth/utp/utp_router.nim b/eth/utp/utp_router.nim index 822fb1e..dbadcae 100644 --- a/eth/utp/utp_router.nim +++ b/eth/utp/utp_router.nim @@ -16,7 +16,7 @@ import export utp_socket logScope: - topics = "utp_router" + topics = "eth utp utp_router" declareCounter utp_received_packets, "All correct received uTP packets" diff --git a/eth/utp/utp_socket.nim b/eth/utp/utp_socket.nim index 3d2801e..9453c75 100644 --- a/eth/utp/utp_socket.nim +++ b/eth/utp/utp_socket.nim @@ -21,7 +21,7 @@ export chronicles logScope: - topics = "utp_socket" + topics = "eth utp utp_socket" type ConnectionState* = enum