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

agave-validator: set_log_filter #4781

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
13 changes: 1 addition & 12 deletions validator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1817,18 +1817,7 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
.subcommand(SubCommand::with_name("run").about("Run the validator"))
.subcommand(commands::plugin::command(default_args))
.subcommand(commands::set_identity::command(default_args))
.subcommand(
SubCommand::with_name("set-log-filter")
.about("Adjust the validator log filter")
.arg(
Arg::with_name("filter").takes_value(true).index(1).help(
"New filter using the same format as the RUST_LOG environment variable",
),
)
.after_help(
"Note: the new filter only applies to the currently running validator instance",
),
)
.subcommand(commands::set_log_filter::command(default_args))
.subcommand(commands::staked_nodes_overrides::command(default_args))
.subcommand(commands::wait_for_restart_window::command(default_args))
.subcommand(
Expand Down
1 change: 1 addition & 0 deletions validator/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ pub mod exit;
pub mod monitor;
pub mod plugin;
pub mod set_identity;
pub mod set_log_filter;
pub mod staked_nodes_overrides;
pub mod wait_for_restart_window;
28 changes: 28 additions & 0 deletions validator/src/commands/set_log_filter/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use {
crate::{admin_rpc_service, cli::DefaultArgs},
clap::{value_t_or_exit, App, Arg, ArgMatches, SubCommand},
std::{path::Path, process::exit},
};

pub fn command(_default_args: &DefaultArgs) -> App<'_, '_> {
SubCommand::with_name("set-log-filter")
.about("Adjust the validator log filter")
.arg(
Arg::with_name("filter")
.takes_value(true)
.index(1)
.help("New filter using the same format as the RUST_LOG environment variable"),
)
.after_help("Note: the new filter only applies to the currently running validator instance")
}

pub fn execute(matches: &ArgMatches, ledger_path: &Path) {
let filter = value_t_or_exit!(matches, "filter", String);
let admin_client = admin_rpc_service::connect(ledger_path);
admin_rpc_service::runtime()
.block_on(async move { admin_client.await?.set_log_filter(filter).await })
.unwrap_or_else(|err| {
println!("set log filter failed: {err}");
exit(1);
});
}
9 changes: 1 addition & 8 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,7 @@ pub fn main() {
return;
}
("set-log-filter", Some(subcommand_matches)) => {
let filter = value_t_or_exit!(subcommand_matches, "filter", String);
let admin_client = admin_rpc_service::connect(&ledger_path);
admin_rpc_service::runtime()
.block_on(async move { admin_client.await?.set_log_filter(filter).await })
.unwrap_or_else(|err| {
println!("set log filter failed: {err}");
exit(1);
});
commands::set_log_filter::execute(subcommand_matches, &ledger_path);
return;
}
("wait-for-restart-window", Some(subcommand_matches)) => {
Expand Down
Loading