Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to specify log location #6459

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions applications/minotari_app_utilities/src/common_cli_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use std::{error::Error, path::PathBuf};

use clap::Args;
use log::Level;
use tari_common::configuration::{ConfigOverrideProvider, Network};

#[derive(Args, Debug)]
Expand All @@ -43,8 +42,9 @@ pub struct CommonCliArgs {
#[clap(short, long, alias = "log_config")]
pub log_config: Option<PathBuf>,

#[clap()]
pub log_level: Option<Level>,
/// The path to where logs should be stored
#[clap(long, alias = "log_path")]
pub log_path: Option<PathBuf>,

/// Supply a network (overrides existing configuration)
#[clap(long, env = "TARI_NETWORK")]
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_console_wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ pub fn run_wallet(shutdown: &mut Shutdown, runtime: Runtime, config: &mut Applic
base_path: data_dir_str,
config: config_path.into_os_string().into_string().unwrap(),
log_config: None,
log_level: None,
network: None,
log_path: None,
config_property_overrides: vec![],
},
password: None,
Expand Down
3 changes: 2 additions & 1 deletion applications/minotari_console_wallet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ fn main_inner() -> Result<(), ExitError> {
let cli = Cli::parse();

let cfg = load_configuration(cli.common.config_path(), true, cli.non_interactive_mode, &cli)?;
let base_path = cli.common.get_base_path();
initialize_logging(
&cli.common.log_config_path("wallet"),
&cli.common.get_base_path(),
cli.common.log_path.as_ref().unwrap_or(&base_path),
include_str!("../log4rs_sample.yml"),
)?;

Expand Down
4 changes: 2 additions & 2 deletions applications/minotari_merge_mining_proxy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ async fn main() -> Result<(), anyhow::Error> {
}

let cli = Cli::parse();

let base_path = cli.common.get_base_path();
initialize_logging(
&cli.common.log_config_path("proxy"),
&cli.common.get_base_path(),
cli.common.log_path.as_ref().unwrap_or(&base_path),
include_str!("../log4rs_sample.yml"),
)?;
match run_merge_miner::start_merge_miner(cli).await {
Expand Down
2 changes: 1 addition & 1 deletion applications/minotari_node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub async fn run_base_node(
base_path: data_dir_str,
config: config_path.into_os_string().into_string().unwrap(),
log_config: None,
log_level: None,
log_path: None,
network: None,
config_property_overrides: vec![],
},
Expand Down
3 changes: 2 additions & 1 deletion applications/minotari_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ fn main_inner() -> Result<(), ExitError> {
console_subscriber::init();
}

let base_path = cli.common.get_base_path();
initialize_logging(
&cli.common.log_config_path("base_node"),
&cli.common.get_base_path(),
cli.common.log_path.as_ref().unwrap_or(&base_path),
include_str!("../log4rs_sample.yml"),
)?;
info!(
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/merge_mining_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl MergeMiningProxyProcess {
base_path: data_dir_str,
config: config_path.into_os_string().into_string().unwrap(),
log_config: None,
log_level: None,
log_path: None,
network: Some("localnet".to_string().try_into().unwrap()),
config_property_overrides: vec![
("merge_mining_proxy.listener_address".to_string(), proxy_full_address),
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl MinerProcess {
base_path: data_dir_str,
config: config_path.into_os_string().into_string().unwrap(),
log_config: None,
log_level: None,
log_path: None,
config_property_overrides: vec![
(
"miner.base_node_grpc_address".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/src/wallet_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ pub fn get_default_cli() -> Cli {
base_path: Default::default(),
config: Default::default(),
log_config: None,
log_level: None,
log_path: None,
network: None,
config_property_overrides: vec![],
},
Expand Down
Loading