-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add tracing subscriber to enable logging #78
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gor027
force-pushed
the
add_logging
branch
4 times, most recently
from
September 20, 2022 13:22
995275e
to
5a9d7c0
Compare
Gor027
force-pushed
the
add_logging
branch
2 times, most recently
from
September 21, 2022 08:55
8beac0e
to
1a66462
Compare
piodul
reviewed
Sep 26, 2022
avelanarius
reviewed
Sep 27, 2022
avelanarius
reviewed
Sep 27, 2022
piodul
reviewed
Sep 27, 2022
piodul
reviewed
Sep 27, 2022
piodul
reviewed
Sep 28, 2022
piodul
reviewed
Sep 28, 2022
piodul
reviewed
Sep 28, 2022
Lorak-mmk
requested changes
Oct 5, 2022
Lorak-mmk
requested changes
Oct 14, 2022
Lorak-mmk
reviewed
Nov 14, 2022
Gor027
force-pushed
the
add_logging
branch
2 times, most recently
from
November 22, 2022 11:01
23c76c5
to
8a3e35f
Compare
Lorak-mmk
requested changes
Nov 23, 2022
5 tasks
Gor027
force-pushed
the
add_logging
branch
2 times, most recently
from
December 10, 2022 12:00
f81fa7c
to
b7c1ae0
Compare
Lorak-mmk
requested changes
Dec 14, 2022
scylla-rust-wrapper/src/logging.rs
Outdated
CassLogLevel::CASS_LOG_ERROR => Level::ERROR, | ||
CassLogLevel::CASS_LOG_WARN => Level::WARN, | ||
CassLogLevel::CASS_LOG_INFO => Level::INFO, | ||
CassLogLevel::CASS_LOG_DEBUG => Level::DEBUG, | ||
CassLogLevel::CASS_LOG_TRACE => Level::TRACE, | ||
CassLogLevel::CASS_LOG_CRITICAL => Level::ERROR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - either put critical on top or reverse the order of other fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Lorak-mmk
approved these changes
Dec 15, 2022
Motivation: Added `tracing-subscriber` crate to have one common way of logging with the Rust driver, as the Rust driver uses `tracing` crate for logging and cpp-rust driver should allow clients to configure logging by specifying the max log level and providing callback that should be called on each event. Solution: As logging should be configured globally, the current implementation creates a custom tracing subscriber with default configuration, which later can be changed by the user. The global and mutable state of the logging configuration is initialized in the `lazy_static!` block, however, it will be evaluated only after the first access in the code. As, the `cass_session_new()` function most probably is the first function that the user will call (almost all tests do that, too), the initialization of logging is chosen to be done in this function. The CassLogMessage has a field `function` that should always be empty, as it cannot be properly set, because event metadata does not include information about it. Enabled `LoggingTests` tests in github actions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
Added
tracing-subscriber
crate to have one common way of logging with the Rust driver, as the Rust driver usestracing
crate for logging and cpp-rust driver should allow clients to configure logging by specifying the max log level and providing callback that should be called on each event.Solution:
As logging should be configured globally, the current implementation creates a custom tracing subscriber with default configuration, which later can be changed by the user. The global and mutable state of the logging configuration is initialized in the
lazy_static!
block, however, it will be evaluated only after the first access in the code. As, thecass_session_new()
function most probably is the first function that the user will call (almost all tests do that, too), the initialization of logging is chosen to be done in this function.The CassLogMessage has a field
function
that should always be empty, as it cannot be properly set, because event metadata does not include information about it.Enabled
LoggingTests
tests in github actions.Pre-review checklist
.github/workflows/build.yaml
ingtest_filter
.