[1/n] Optimize new tracing logger #3040
Merged
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.
This implements two improvements to our new tracing logger.
callsite as much as possible.
representation of the logs, we use a writer now to collect the log
line as we visit the event.
Note
Monomorphizes legacy text/JSON log formatting and writes events directly to the output, refactoring setup to select concrete formatters and integrate OTEL.
LegacyFormattertrait with concreteTextFormatterandJsonFormatterthat write directly to aWritetarget (no intermediateString).LegacyFormatLayer<W>withLegacyFormatLayer<W, F>generic over formatter, enabling inlined, monomorphizedon_eventpaths.TextFormatteroutputs fern-compatible text;JsonFormatterbuilds JSON viaserde_json::to_writer.DirectWriteVisitorwrites themessagefield directly;MessageVisitorsimplified for JSON extraction.setup_legacy_formatnow matches on(format, export_to, stdout)to instantiate concrete formatters and writers (stdout or date-based file) and optionally attach OTEL viacreate_otel_layer.session_id/machine_id; session ID inclusion handled by formatter construction.Written by Cursor Bugbot for commit cb1895c. This will update automatically on new commits. Configure here.