Skip to content

Add --log quiet flag to suppress informational logs - #216

Merged
hicksy merged 3 commits into
nubo-db:mainfrom
zhua633:feat/quiet-log
Sep 29, 2026
Merged

hicksy merged 3 commits into
nubo-db:mainfrom
zhua633:feat/quiet-log

Conversation

@zhua633

@zhua633 zhua633 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

What this changes

Thanks for looking at the issue 🙏 This attempts to add --log quiet as described, let me know if this isn't quite what you had in mind

Tested locally built binary:

before after
Screenshot 2026-09-28 at 4 33 11 pm Screenshot 2026-09-28 at 4 31 49 pm

Checklist

  • Tests added or updated
  • cargo fmt --check and cargo clippy -- -D warnings pass locally
  • CHANGELOG.md updated if this is a user-visible change
  • Linked issue, discussion, or a short note explaining the
    motivation
  • I agree my contribution is licensed under the project's terms
    (MIT License and Apache License, Version 2.0)

DynamoDB compatibility note (delete if not applicable)

@zhua633
zhua633 requested a review from hicksy as a code owner September 28, 2026 06:48

@hicksy hicksy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, and for picking it up so soon after #215. It's the shape I had in mind: --log with quiet as the first value, and nothing changes when the flag is absent. I built it locally and reverted each of the two guards in turn, and log_quiet_suppresses_serve_startup_messages fails both times, so the coverage is real.

A few things before I merge, none of them big:

  • The shutdown line still prints. With --log quiet, stopping the server with SIGTERM or Ctrl+C still writes a blank line and Shutting down... to stderr. Most test runners stop the server that way at teardown, so the noise from #215 comes back at the end of the run. The test misses it because child.kill() sends SIGKILL. Inline note on where it comes from.
  • CHANGELOG. The box is ticked but CHANGELOG.md isn't in the diff. An entry under [Unreleased] would cover the flag, plus a line for server::ServerOptions and server::start_with_options, since they're new public API in the crate.
  • The startup line is a documented promise. The "What a container waits on" section of docs/versioning.md tells container tooling it can wait on Dynoxide listening on http://<host>:<port>. That still holds by default, but a sentence there saying --log quiet drops the line, and that a wait on GET / works either way, would save someone who combines the two a confusing timeout.
  • Docs placement. Both new doc blocks land mid-flow. Inline notes.

Smaller bits inline: dropping Copy from ServerOptions, a line of help text on Quiet, and the --quiet assertions in the tests.

One thing to leave out: serve --mcp --log quiet still prints the MCP listener line. Quieting it needs a new field on mcp::HttpOptions, which has public fields, so adding one is a breaking change for the crate. I'll pick that up separately along with import --serve, so no need to touch it here.

Not far off - happy to merge once those are sorted.

Comment thread src/server/mod.rs Outdated
}

axum::serve(listener, app)
.with_graceful_shutdown(shutdown_signal())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the shutdown message comes from. shutdown_signal() further down prints \nShutting down... once it sees SIGTERM or Ctrl+C, and quiet mode never reaches it. Passing the options through (shutdown_signal(options) or similar) would cover it, and suppress_startup_messages probably wants a broader name like quiet once it covers shutdown too.

For the test, on unix you can send SIGTERM instead of child.kill(), e.g. Command::new("kill").args(["-TERM", &child.id().to_string()]) behind #[cfg(unix)]. Wait for GET / to answer rather than a bare TCP connect, then assert the process exits successfully. A clean exit shows the signal went through the handler; if it ever arrives before the handler is installed, the process dies from the signal and the test fails loudly instead of passing without checking anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch, totally missed this one thank you 🙏

Comment thread src/server/mod.rs Outdated
const STREAMS_TARGET_PREFIX: &str = "DynamoDBStreams_20120810.";

/// Options controlling HTTP server startup.
#[derive(Debug, Clone, Copy, Default)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we drop Copy? ServerOptions is public, and the obvious next field is whatever --log verbose needs for #14, which may well not be Copy. Taking the derive away later is a breaking change for the crate. mcp::HttpOptions and McpConfig derive Clone, Debug only.

Comment thread src/main.rs

#[derive(Clone, Copy, Debug, PartialEq, Eq, ValueEnum)]
enum LogMode {
Quiet,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--help only says "Logging mode" at the moment. A doc comment on the variant gets picked up, so /// Suppress informational startup and shutdown messages above Quiet shows under "Possible values" in serve --help.

Comment thread src/main.rs Outdated
}

#[test]
fn legacy_and_unsupported_log_modes_are_rejected() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's never been a --quiet flag, so "legacy" is a bit misleading, and clap rejects unknown flags anyway. verbose is the value I'm planning to add for #14, so this would need deleting then. A nonsense value like --log loud covers the invalid-value case without pinning either.

Comment thread tests/serve_schema.rs Outdated
}

#[test]
fn serve_help_lists_log_but_not_quiet_flag() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. The --log <MODE> check is worth having and matches the --schema help tests above, but the --quiet half can go (in root_help_lists_log_but_not_quiet_flag too), and the names can lose the "but_not_quiet" bit.

Comment thread docs/http-server.md Outdated
dynoxide --schema schema.json --port 8000
```

## Logging

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lands between the schema example and "Then use the AWS CLI or any DynamoDB SDK pointed at localhost", so that sentence now follows the logging section. Moving it to the end of the page keeps start-then-connect together.

Comment thread README.md Outdated
npx dynoxide --port 8000
```

Add `--log quiet` to suppress informational startup messages on stderr (useful

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next two paragraphs start "Or install it..." and "Or run it in Docker...", offering alternatives to the npx line, so they read oddly after this note. Could it go after the "Point any AWS SDK..." paragraph instead?

@hicksy
hicksy merged commit 4c00c23 into nubo-db:main Sep 29, 2026
18 checks passed
@hicksy

hicksy commented Sep 29, 2026

Copy link
Copy Markdown
Member

Merged - thanks @zhua633, and for turning the feedback round so quickly. I reverted the shutdown guard to check the new SIGTERM test and it fails, so it's covering what it should. I'll follow up with a #[cfg(unix)] on that test and a docs tweak to mention shutdown, so nothing more needed from you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants