Skip to content

Commit

Permalink
fix(1297): spacetime logs -f should not start at the very beginning (
Browse files Browse the repository at this point in the history
…#1298)

* [bfops/logs-f]: do thing

* [bfops/logs-f]: empty

* [bfops/logs-f]: review

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
  • Loading branch information
bfops committed May 28, 2024
1 parent 1f23316 commit 8096ab6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/cli/src/subcommands/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct LogsParams {
pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::Error> {
let server = args.get_one::<String>("server").map(|s| s.as_ref());
let identity = args.get_one::<String>("identity");
let num_lines = args.get_one::<u32>("num_lines").copied();
let mut num_lines = args.get_one::<u32>("num_lines").copied();
let database = args.get_one::<String>("database").unwrap();
let follow = args.get_flag("follow");
let json = args.get_flag("json");
Expand All @@ -107,7 +107,10 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E

let address = database_address(&config, database, server).await?;

// TODO: num_lines should default to like 10 if follow is specified?
if follow && num_lines.is_none() {
// We typically don't want logs from the very beginning if we're also following.
num_lines = Some(10);
}
let query_parms = LogsParams { num_lines, follow };

let builder = reqwest::Client::new().get(format!("{}/database/logs/{}", config.get_host_url(server)?, address));
Expand Down

0 comments on commit 8096ab6

Please sign in to comment.