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

fix(1297): spacetime logs -f should not start at the very beginning #1298

Merged
merged 3 commits into from
May 28, 2024
Merged
Changes from 2 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
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(num_lines.unwrap_or(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
Loading