Skip to content

Commit

Permalink
doc/command doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Jan 2, 2025
1 parent f794004 commit ce6a072
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
4 changes: 1 addition & 3 deletions docs/EXECUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ Many people run programs by double-clicking an icon and interacting only with th

But while gossip is a GUI desktop program, it also outputs a lot of messages to the console as it runs. I recommend you keep the console open and pay some attention to errors or other odd behavior that may become apparent from the console messages.

Gossip logs a lot, and important messages can get missed. In order to only see the important messages, you can change the log level. Every log message is tagged by a log level, one of `error`, `warn`, `info`, `debug` or `trace`. You can specify a cut-off to see fewer messages by setting the environment variable `RUST_LOG` to the level you desire, such as `RUST_LOG=warn`. If not specified otherwise, gossip defaults to the `info` log level.

There are other things you can specify in `RUST_LOG`, such as which level to log on a crate-by-crate basis. For example: `RUST_LOG="warn,gossip=info,gossip_lib=info,nostr_types=info"`
Gossip logs a lot, and important messages can get missed. In order to only see the important messages, you can change the log level. Every log message is tagged by a log level, one of `error`, `warn`, `info`, `debug` or `trace`. You can specify a cut-off to see fewer messages by setting the environment variable `RUST_LOG` to the level you desire, such as `RUST_LOG=warn`. If not specified otherwise, gossip defaults to the `info` log level. There are other things you can specify in `RUST_LOG`, such as which level to log on a crate-by-crate basis. For example: `RUST_LOG="warn,gossip=info,gossip_lib=info,nostr_types=info"`, or turning logging off entirely with `RUST_LOG=off`. See [env_logger documentation](https://docs.rs/env_logger/latest/env_logger/#enabling-logging) for more.

Gossip logs to stderr by default now (this used to be stdout). This helps differentiate log messages from command line outputs.

Expand Down
17 changes: 12 additions & 5 deletions gossip-bin/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const COMMANDS: [Command; 44] = [
Command {
cmd: "help",
usage_params: "<command>",
desc: "show this list",
desc: "show documentation of <command> if <command is specified, otherwise documentation of all commands",
},
Command {
cmd: "import_encrypted_private_key",
Expand Down Expand Up @@ -323,22 +323,29 @@ pub fn handle_command(mut args: env::Args) -> Result<bool, Error> {
}

pub fn help(_cmd: Command, mut args: env::Args) -> Result<(), Error> {

if let Some(sub) = args.next() {
for c in COMMANDS.iter() {
if sub == c.cmd {
println!("gossip {} {}", c.cmd, c.usage_params);
println!(" {}", c.desc);
println!("Usage: gossip {} {}", c.cmd, c.usage_params);
println!("");
println!(" {}", c.desc);
return Ok(());
}
}
println!("No such command {}", sub);
} else {
println!("Usage: gossip [--rapid] <cmd>");
println!("");
println!(" --rapid Use faster storage access at the risk of data corruption");
println!("");
println!(" <cmd> can be any of these:");
for c in COMMANDS.iter() {
if c.cmd == "oneshot" {
continue;
}
println!(" {} {}", c.cmd, c.usage_params);
println!(" {}", c.desc);
println!(" {} {}", c.cmd, c.usage_params);
println!(" {}", c.desc);
}
}
Ok(())
Expand Down

0 comments on commit ce6a072

Please sign in to comment.