Skip to content

Conversation

@LucioFranco
Copy link
Contributor

@LucioFranco LucioFranco commented Nov 26, 2025

This implements two improvements to our new tracing logger.

  • Inline the different formats so that the compiler can optimize the
    callsite as much as possible.
  • Instead of allocating a string to represent the intermediate
    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.

  • Logger performance/structure:
    • Introduces LegacyFormatter trait with concrete TextFormatter and JsonFormatter that write directly to a Write target (no intermediate String).
    • Replaces LegacyFormatLayer<W> with LegacyFormatLayer<W, F> generic over formatter, enabling inlined, monomorphized on_event paths.
    • TextFormatter outputs fern-compatible text; JsonFormatter builds JSON via serde_json::to_writer.
    • New DirectWriteVisitor writes the message field directly; MessageVisitor simplified for JSON extraction.
  • Setup refactor:
    • setup_legacy_format now matches on (format, export_to, stdout) to instantiate concrete formatters and writers (stdout or date-based file) and optionally attach OTEL via create_otel_layer.
    • Signature updated to use 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.

Created using jj-spr 0.1.0
@vercel
Copy link

vercel bot commented Nov 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Nov 26, 2025 9:52pm
framework-docs Ready Ready Preview Comment Nov 26, 2025 9:52pm

@LucioFranco LucioFranco requested a review from a team November 26, 2025 16:54
@LucioFranco LucioFranco changed the title Optimize new tracing logger [1/n] Optimize new tracing logger Nov 26, 2025
Created using jj-spr 0.1.0
@LucioFranco LucioFranco added this pull request to the merge queue Dec 1, 2025
Merged via the queue into main with commit a1c14f3 Dec 1, 2025
56 checks passed
@LucioFranco LucioFranco deleted the spr/lucio/optimize-new-tracing-logger branch December 1, 2025 22:48
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.

3 participants