Skip to content

Conversation

@tisonkun
Copy link
Contributor

@tisonkun tisonkun commented Jan 5, 2026

See changelog updates.

Copy link

Copilot AI left a 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 Record payload from OwnedStr to fmt::Arguments<'a> to avoid unnecessary string allocations
  • Removed OwnedStr and RecordOwned types from the core library (moved RecordOwned to async worker)
  • Replaced crossbeam-channel with std::sync::mpsc in 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>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun enabled auto-merge (squash) January 6, 2026 00:57
@tisonkun tisonkun merged commit e909a1e into main Jan 6, 2026
10 checks passed
@tisonkun tisonkun deleted the api branch January 6, 2026 01:00
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.

2 participants