-
Notifications
You must be signed in to change notification settings - Fork 25
refactor!: rework core api #212
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
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.
Pull request overview
This PR refactors the core API to change how log message payloads are handled throughout the logging framework. The primary change is replacing string-based payloads with std::fmt::Arguments<'a>, which allows for zero-cost formatted message handling by deferring string allocation until necessary.
Key Changes:
- Changed
Recordpayload fromOwnedStrtofmt::Arguments<'a>to avoid unnecessary string allocations - Removed
OwnedStrandRecordOwnedtypes from the core library (movedRecordOwnedto async worker) - Replaced
crossbeam-channelwithstd::sync::mpscin the async appender to reduce dependencies
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
core/src/record.rs |
Changed payload type from OwnedStr to fmt::Arguments<'a>, removed RecordOwned, added time() and column() builder methods |
core/src/str.rs |
Removed OwnedStr type and its into_owned() method, added into_cow_static() to RefStr |
core/src/kv.rs |
Updated KeyOwned to use Cow<'static, str> instead of OwnedStr |
layouts/logfmt/src/lib.rs |
Adapted to handle fmt::Arguments payload by converting to Cow<str> |
layouts/json/src/lib.rs |
Changed RecordLine.message to fmt::Arguments<'a> for direct serialization |
layouts/google-cloud-logging/src/lib.rs |
Changed RecordLine.message to fmt::Arguments<'a> for direct serialization |
bridges/log/src/lib.rs |
Simplified payload handling by directly passing fmt::Arguments |
appenders/opentelemetry/src/lib.rs |
Updated to call to_string() instead of to_owned() on payload |
appenders/journald/src/field.rs |
Added PutAsFieldValue implementation for fmt::Arguments<'_> |
appenders/fastrace/src/lib.rs |
Adapted to convert payload to Cow<str> |
appenders/async/src/worker.rs |
Moved RecordOwned into this module and adapted to reconstruct records from owned data |
appenders/async/src/state.rs |
Updated error types from crossbeam_channel to std::sync::mpsc |
appenders/async/src/lib.rs |
Implemented custom Sender enum to wrap both bounded and unbounded channels |
appenders/async/src/append.rs |
Updated to use new Sender type and RecordOwned::from_record() |
appenders/async/Cargo.toml |
Removed crossbeam-channel dependency |
Cargo.toml |
Removed crossbeam-channel from workspace dependencies |
appenders/file/tests/global_file_limit.rs |
Updated tests to use format_args!() instead of format!() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: tison <wander4096@gmail.com>
See changelog updates.