-
Notifications
You must be signed in to change notification settings - Fork 0
cblite 3.2.2 update: New logging API #30
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
Conversation
@@ -11,6 +11,7 @@ keywords = ["couchbase"] | |||
categories = ["database"] | |||
|
|||
[dependencies] | |||
bitflags = "2.9.0" |
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.
PR review help: New dependency to implement bit masks (we need to map to a CBlite C structure that create bit mask to concatenate domains to log, see
couchbase-lite-rust/libcblite_community/include/cbl/CBLLogSinks.h
Lines 50 to 61 in 3ffe3a4
/** A bitmask representing a set of logging domains. | |
* | |
* Use this bitmask to specify one or more logging domains by combining the | |
* constants with the bitwise OR operator (`|`). This is helpful for enabling | |
* or filtering logs for specific domains. */ | |
typedef CBL_OPTIONS(uint16_t, CBLLogDomainMask) { | |
kCBLLogDomainMaskDatabase = 1 << kCBLLogDomainDatabase, | |
kCBLLogDomainMaskQuery = 1 << kCBLLogDomainQuery, | |
kCBLLogDomainMaskReplicator = 1 << kCBLLogDomainReplicator, | |
kCBLLogDomainMaskNetwork = 1 << kCBLLogDomainNetwork, | |
kCBLLogDomainMaskAll = 0xFF | |
}; |
log_sink.level = kCBLLogDebug; | ||
log_sink.domains = kCBLLogDomainMaskAll; | ||
|
||
CBLLogSinks_SetConsole(log_sink); |
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.
PR review help: Just for testing...
level: log_sink.level as u8, | ||
callback: Some(invoke_log_callback), | ||
domains: log_sink.domains.bits() as u16, | ||
}) |
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.
PR review help: implementation of CBLite C lib (thanks to bindings), more info in
Line 126 in 36a9151
fn generate_bindings() -> Result<(), Box<dyn Error>> { |
$crate::logging::Domain::Database, $crate::logging::Level::Debug, | ||
format_args!($($arg)*))); | ||
} | ||
|
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.
PR review help: Removed because useless
New Logging API
Couchbase Lite 3.2.2 introduces a new Logging API. The new Logging API has the following benefits: