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

Book: Logging #58

Open
killercup opened this issue Aug 2, 2018 · 1 comment
Open

Book: Logging #58

killercup opened this issue Aug 2, 2018 · 1 comment

Comments

@killercup
Copy link
Contributor

  • log crate: macros with similar syntax to println
  • crate for actual log output -- which one? env_logger?
@Screwtapello
Copy link

I'm not a big fan of env_logger because you have to set a magic environment variable to get any output, which makes it difficult to integrate with the traditional --verbose and --quiet command-line arguments. The clap-verbosity-flag crate takes care of that, but that only works for one module; if you want to figure out what your program is really doing and turn up the logging verbosity everywhere, you're out of luck.

I've had good results with fern, although it doesn't integrate with clap out of the box.

Some command-line tools used as part of larger batch processes might have their logs fed into a rich data store like ElasticSearch or journald; in those cases, the slog crate and its ecosystem might be a better fit than the log crate, since it's designed around logging structured data rather than strings.

killercup referenced this issue in rust-cli/team Nov 30, 2018
cf. #68

For now, suggests using env_logger, as it's pretty popular, but notes
that there are alternatives to consider.

Might mention convey when it covers logging, too.
@epage epage transferred this issue from rust-cli/team Jul 19, 2021
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

No branches or pull requests

2 participants