forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
31 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters