Conversation
There was a problem hiding this comment.
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>
This file contains hidden or 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
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.
See changelog updates.