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

feat(log): switch to tracing for logging #163

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

woshilapin
Copy link
Contributor

resolves #161

Description

Only changing env_logger into tracing-subscriber. It should support the same configuration with RUST_LOG (and more, if we convert from log to tracing later).

Motivation and Context

See #161.

How Has This Been Tested?

Logging are usually not tested. If any test would be needed, could you give some pointers?

Changelog Entry

### Changed

- Changes the logger formatter to `tracing-subscriber`

-->

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@woshilapin woshilapin requested a review from orhun as a code owner October 15, 2023 21:17
@orhun
Copy link
Owner

orhun commented Oct 18, 2023

Looks great! We only need one change, see #161 (comment)

@woshilapin
Copy link
Contributor Author

Looks great! We only need one change, see #161 (comment)

@orhun Sure thing, here it is in a404dfc.

@codecov-commenter
Copy link

codecov-commenter commented Oct 18, 2023

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files Coverage Δ
src/auth.rs 90.90% <100.00%> (ø)
src/middleware.rs 72.00% <100.00%> (ø)
src/config.rs 82.85% <25.00%> (ø)
src/server.rs 82.87% <66.66%> (ø)
src/main.rs 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

📢 Thoughts on this report? Let us know!.

@orhun
Copy link
Owner

orhun commented Oct 18, 2023

LGTM, just one thing, can you configure tracing subscriber so that the default log level will be INFO? Because now if you run rustypaste then you get no output. We should somehow use INFO as default to not break CLI backwards compatibility.

@woshilapin
Copy link
Contributor Author

LGTM, just one thing, can you configure tracing subscriber so that the default log level will be INFO? Because now if you run rustypaste then you get no output. We should somehow use INFO as default to not break CLI backwards compatibility.

@orhun Good point. Done in b18610c thanks to https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#method.from_default_env.

Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

Super awesome!

@orhun orhun changed the title feat(log): use 'tracing-subscriber' instead of 'env_logger' feat(log): switch to tracing for logging Oct 20, 2023
@orhun orhun merged commit 70541bb into orhun:master Oct 20, 2023
8 checks passed
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.

Use tracing instead of log
3 participants