Skip to content

Commit

Permalink
feat: log app version on startup (#4970)
Browse files Browse the repository at this point in the history
* Log base_node and FFI version on startup

* clippy
  • Loading branch information
SWvheerden authored Nov 29, 2022
1 parent 5de63d3 commit 2962028
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion applications/tari_base_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ use std::{process, sync::Arc};

use clap::Parser;
use log::*;
use tari_app_utilities::{identity_management::setup_node_identity, utilities::setup_runtime};
use tari_app_utilities::{consts, identity_management::setup_node_identity, utilities::setup_runtime};
use tari_base_node::{cli::Cli, run_base_node_with_cli, ApplicationConfig};
use tari_common::{exit_codes::ExitError, initialize_logging, load_configuration};
use tari_comms::peer_manager::PeerFeatures;
Expand Down Expand Up @@ -111,6 +111,11 @@ fn main_inner() -> Result<(), ExitError> {
&cli.common.log_config_path("base_node"),
include_str!("../log4rs_sample.yml"),
)?;
info!(
target: LOG_TARGET,
"Starting Tari Base Node version: {}",
consts::APP_VERSION
);

let mut config = ApplicationConfig::load_from(&cfg)?;
if let Some(network) = cli.network {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ mod test {
let cipher = XChaCha20Poly1305::new(key_ga);

let (_, uo) = make_input(MicroTari::from(100 + OsRng.next_u64() % 1000));
let decrypted_spending_key = uo.spending_key.clone().to_vec();
let decrypted_spending_key = uo.spending_key.to_vec();

let uo = DbUnblindedOutput::from_unblinded_output(uo, &factories, None, OutputSource::Unknown).unwrap();

Expand Down
1 change: 1 addition & 0 deletions base_layer/wallet_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ tari_service_framework = { path = "../../base_layer/service_framework" }

[build-dependencies]
cbindgen = "0.24.3"
tari_common = { path = "../../common", features = ["build", "static-application-info"] }
5 changes: 5 additions & 0 deletions base_layer/wallet_ffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@
use std::{env, path::PathBuf};

use cbindgen::{Config, ExportConfig, Language, ParseConfig, Style};
use tari_common::build::StaticApplicationInfo;

fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();

// generate version info
let gen = StaticApplicationInfo::initialize().unwrap();
gen.write_consts_to_outdir("consts.rs").unwrap();

// let package_name = env::var("CARGO_PKG_NAME").unwrap();
let output_file = PathBuf::from(&crate_dir).join("wallet.h").display().to_string();

Expand Down
10 changes: 10 additions & 0 deletions base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ mod error;
mod output_manager_service_mock;
mod tasks;

mod consts {
// Import the auto-generated const values from the Manifest and Git
include!(concat!(env!("OUT_DIR"), "/consts.rs"));
}

const LOG_TARGET: &str = "wallet_ffi";

pub type TariTransportConfig = tari_p2p::TransportConfig;
Expand Down Expand Up @@ -4296,6 +4301,11 @@ pub unsafe extern "C" fn wallet_create(
return ptr::null_mut();
}
}
info!(
target: LOG_TARGET,
"Starting Tari Wallet FFI version: {}",
consts::APP_VERSION
);

let passphrase_option = if passphrase.is_null() {
None
Expand Down

0 comments on commit 2962028

Please sign in to comment.