Skip to content

Commit 6166ad2

Browse files
Replace tracing::debug! with debug! same for other levels (#8300)
Just visual clean-up, making logging statements look uniform. There's no reason to use `tracing::debug` instead of `debug`. If we ever need to migrate our logging lib in the future it would make things easier too. Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com>
1 parent 0706e62 commit 6166ad2

File tree

7 files changed

+26
-24
lines changed

7 files changed

+26
-24
lines changed

beacon_node/lighthouse_network/src/types/globals.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use network_utils::enr_ext::EnrExt;
99
use parking_lot::RwLock;
1010
use std::collections::HashSet;
1111
use std::sync::Arc;
12-
use tracing::error;
12+
use tracing::{debug, error};
1313
use types::data_column_custody_group::{compute_subnets_from_custody_group, get_custody_groups};
1414
use types::{ChainSpec, ColumnIndex, DataColumnSubnetId, EthSpec};
1515

@@ -79,7 +79,7 @@ impl<E: EthSpec> NetworkGlobals<E> {
7979
sampling_subnets.extend(subnets);
8080
}
8181

82-
tracing::debug!(
82+
debug!(
8383
cgc = custody_group_count,
8484
?sampling_subnets,
8585
"Starting node with custody params"

beacon_node/lighthouse_network/tests/rpc_tests.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::sync::Arc;
1414
use std::time::{Duration, Instant};
1515
use tokio::runtime::Runtime;
1616
use tokio::time::sleep;
17-
use tracing::{Instrument, debug, error, info_span, warn};
17+
use tracing::{Instrument, debug, error, info, info_span, warn};
1818
use types::{
1919
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BeaconBlockHeader,
2020
BlobSidecar, ChainSpec, DataColumnSidecar, DataColumnsByRootIdentifier, EmptyBlock, Epoch,
@@ -1041,7 +1041,7 @@ fn test_tcp_columns_by_root_chunked_rpc() {
10411041
loop {
10421042
match sender.next_event().await {
10431043
NetworkEvent::PeerConnectedOutgoing(peer_id) => {
1044-
tracing::info!("Sending RPC");
1044+
info!("Sending RPC");
10451045
tokio::time::sleep(Duration::from_secs(1)).await;
10461046
sender
10471047
.send_request(peer_id, AppRequestId::Router, rpc_request.clone())
@@ -1055,7 +1055,7 @@ fn test_tcp_columns_by_root_chunked_rpc() {
10551055
Response::DataColumnsByRoot(Some(sidecar)) => {
10561056
assert_eq!(sidecar, data_column.clone());
10571057
messages_received += 1;
1058-
tracing::info!("Chunk received");
1058+
info!("Chunk received");
10591059
}
10601060
Response::DataColumnsByRoot(None) => {
10611061
// should be exactly messages_to_send
@@ -1082,27 +1082,27 @@ fn test_tcp_columns_by_root_chunked_rpc() {
10821082
} => {
10831083
if request_type == rpc_request {
10841084
// send the response
1085-
tracing::info!("Receiver got request");
1085+
info!("Receiver got request");
10861086

10871087
for _ in 0..messages_to_send {
10881088
receiver.send_response(
10891089
peer_id,
10901090
inbound_request_id,
10911091
rpc_response.clone(),
10921092
);
1093-
tracing::info!("Sending message");
1093+
info!("Sending message");
10941094
}
10951095
// send the stream termination
10961096
receiver.send_response(
10971097
peer_id,
10981098
inbound_request_id,
10991099
Response::DataColumnsByRoot(None),
11001100
);
1101-
tracing::info!("Send stream term");
1101+
info!("Send stream term");
11021102
}
11031103
}
11041104
e => {
1105-
tracing::info!(?e, "Got event");
1105+
info!(?e, "Got event");
11061106
} // Ignore other events
11071107
}
11081108
}
@@ -1186,7 +1186,7 @@ fn test_tcp_columns_by_range_chunked_rpc() {
11861186
loop {
11871187
match sender.next_event().await {
11881188
NetworkEvent::PeerConnectedOutgoing(peer_id) => {
1189-
tracing::info!("Sending RPC");
1189+
info!("Sending RPC");
11901190
sender
11911191
.send_request(peer_id, AppRequestId::Router, rpc_request.clone())
11921192
.unwrap();
@@ -1199,7 +1199,7 @@ fn test_tcp_columns_by_range_chunked_rpc() {
11991199
Response::DataColumnsByRange(Some(sidecar)) => {
12001200
assert_eq!(sidecar, data_column.clone());
12011201
messages_received += 1;
1202-
tracing::info!("Chunk received");
1202+
info!("Chunk received");
12031203
}
12041204
Response::DataColumnsByRange(None) => {
12051205
// should be exactly messages_to_send
@@ -1226,23 +1226,23 @@ fn test_tcp_columns_by_range_chunked_rpc() {
12261226
} => {
12271227
if request_type == rpc_request {
12281228
// send the response
1229-
tracing::info!("Receiver got request");
1229+
info!("Receiver got request");
12301230

12311231
for _ in 0..messages_to_send {
12321232
receiver.send_response(
12331233
peer_id,
12341234
inbound_request_id,
12351235
rpc_response.clone(),
12361236
);
1237-
tracing::info!("Sending message");
1237+
info!("Sending message");
12381238
}
12391239
// send the stream termination
12401240
receiver.send_response(
12411241
peer_id,
12421242
inbound_request_id,
12431243
Response::DataColumnsByRange(None),
12441244
);
1245-
tracing::info!("Send stream term");
1245+
info!("Send stream term");
12461246
}
12471247
}
12481248
_ => {} // Ignore other events

beacon_node/network/src/sync/backfill_sync/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl<T: BeaconChainTypes> BackFillSync<T> {
346346
}
347347
}
348348
CouplingError::BlobPeerFailure(msg) => {
349-
tracing::debug!(?batch_id, msg, "Blob peer failure");
349+
debug!(?batch_id, msg, "Blob peer failure");
350350
}
351351
CouplingError::InternalError(msg) => {
352352
error!(?batch_id, msg, "Block components coupling internal error");

beacon_node/network/src/sync/block_sidecar_coupling.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ impl<E: EthSpec> RangeBlockComponentsRequest<E> {
357357
// we request the data from.
358358
// If there are duplicated indices, its likely a peer sending us the same index multiple times.
359359
// However we can still proceed even if there are extra columns, just log an error.
360-
tracing::debug!(?block_root, ?index, "Repeated column for block_root");
360+
debug!(?block_root, ?index, "Repeated column for block_root");
361361
continue;
362362
}
363363
}
@@ -408,7 +408,7 @@ impl<E: EthSpec> RangeBlockComponentsRequest<E> {
408408
if !data_columns_by_index.is_empty() {
409409
let remaining_indices = data_columns_by_index.keys().collect::<Vec<_>>();
410410
// log the error but don't return an error, we can still progress with extra columns.
411-
tracing::debug!(
411+
debug!(
412412
?block_root,
413413
?remaining_indices,
414414
"Not all columns consumed for block"
@@ -428,7 +428,7 @@ impl<E: EthSpec> RangeBlockComponentsRequest<E> {
428428
let remaining_roots = data_columns_by_block.keys().collect::<Vec<_>>();
429429
// log the error but don't return an error, we can still progress with responses.
430430
// this is most likely an internal error with overrequesting or a client bug.
431-
tracing::debug!(?remaining_roots, "Not all columns consumed for block");
431+
debug!(?remaining_roots, "Not all columns consumed for block");
432432
}
433433

434434
Ok(rpc_blocks)

beacon_node/network/src/sync/range_sync/chain.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::collections::{BTreeMap, HashSet, btree_map::Entry};
1818
use std::hash::{Hash, Hasher};
1919
use std::marker::PhantomData;
2020
use strum::IntoStaticStr;
21-
use tracing::{Span, debug, instrument, warn};
21+
use tracing::{Span, debug, error, instrument, warn};
2222
use types::{ColumnIndex, Epoch, EthSpec, Hash256, Slot};
2323

2424
/// Blocks are downloaded in batches from peers. This constant specifies how many epochs worth of
@@ -942,10 +942,10 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
942942
}
943943
}
944944
CouplingError::BlobPeerFailure(msg) => {
945-
tracing::debug!(?batch_id, msg, "Blob peer failure");
945+
debug!(?batch_id, msg, "Blob peer failure");
946946
}
947947
CouplingError::InternalError(msg) => {
948-
tracing::error!(?batch_id, msg, "Block components coupling internal error");
948+
error!(?batch_id, msg, "Block components coupling internal error");
949949
}
950950
}
951951
}

boot_node/src/config.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use ssz::Encode;
1414
use std::net::{SocketAddrV4, SocketAddrV6};
1515
use std::time::Duration;
1616
use std::{marker::PhantomData, path::PathBuf};
17+
use tracing::{info, warn};
1718
use types::EthSpec;
1819

1920
/// A set of configuration parameters for the bootnode, established from CLI arguments.
@@ -117,15 +118,15 @@ impl<E: EthSpec> BootNodeConfig<E> {
117118
let genesis_state_root = genesis_state
118119
.canonical_root()
119120
.map_err(|e| format!("Error hashing genesis state: {e:?}"))?;
120-
tracing::info!(root = ?genesis_state_root, "Genesis state found");
121+
info!(root = ?genesis_state_root, "Genesis state found");
121122
let enr_fork = spec.enr_fork_id::<E>(
122123
types::Slot::from(0u64),
123124
genesis_state.genesis_validators_root(),
124125
);
125126

126127
Some(enr_fork.as_ssz_bytes())
127128
} else {
128-
tracing::warn!("No genesis state provided. No Eth2 field added to the ENR");
129+
warn!("No genesis state provided. No Eth2 field added to the ENR");
129130
None
130131
}
131132
};

lighthouse/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,8 @@ fn run<E: EthSpec>(
730730

731731
#[cfg(all(feature = "modern", target_arch = "x86_64"))]
732732
if !std::is_x86_feature_detected!("adx") {
733-
tracing::warn!(
733+
use tracing::warn;
734+
warn!(
734735
advice = "If you get a SIGILL, please try Lighthouse portable build",
735736
"CPU seems incompatible with optimized Lighthouse build"
736737
);

0 commit comments

Comments
 (0)