Skip to content

Commit

Permalink
Log build + feature information at startup in aptos node (aptos-labs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
banool authored Sep 3, 2022
1 parent 566aeba commit 0a7cfe7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions aptos-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#![forbid(unsafe_code)]

mod log_build_information;

use anyhow::anyhow;
use aptos_api::bootstrap as bootstrap_api;
use aptos_build_info::build_information;
Expand Down Expand Up @@ -40,6 +42,7 @@ use executor::{chunk_executor::ChunkExecutor, db_bootstrapper::maybe_bootstrap};
use framework::ReleaseBundle;
use futures::channel::mpsc;
use hex::FromHex;
use log_build_information::log_build_information;
use mempool_notifications::MempoolNotificationSender;
use network::application::storage::PeerMetadataStorage;
use network_builder::builder::NetworkBuilder;
Expand Down Expand Up @@ -197,6 +200,9 @@ pub fn start(config: NodeConfig, log_file: Option<PathBuf>) -> anyhow::Result<()
}
let _logger = logger.build();

// Print out build information.
log_build_information();

// Let's now log some important information, since the logger is set up
info!(config = config, "Loaded AptosNode config");

Expand Down
28 changes: 28 additions & 0 deletions aptos-node/src/log_build_information.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0

use aptos_build_info::build_information;
use aptos_logger::info;

macro_rules! log_feature_info {
($($feature:literal),*) => {
$(
if cfg!(feature = $feature) {
info!("Running with {} feature enabled", $feature);
} else {
info!("Running with {} feature disabled", $feature);
}
)*
}
}

// Naturally this should only be called after a logger has been set up.
pub fn log_build_information() {
info!("Build information:");
let build_info = build_information!();
for (key, value) in build_info {
info!("{}: {}", key, value);
}
info!("Feature information:");
log_feature_info!("failpoints", "assert-private-keys-not-cloneable");
}

0 comments on commit 0a7cfe7

Please sign in to comment.