Skip to content

Conversation

@LucioFranco
Copy link
Contributor

@LucioFranco LucioFranco commented Dec 4, 2025

Note

Sanitizes all log messages to single-line, normalized whitespace and removes emojis from runtime logs; updates docs and adds tests.

  • Logging:
    • Add sanitize_message to strip newlines and collapse whitespace; applied in legacy TextFormatter and JsonFormatter so message is sanitized before output.
    • Remove DirectWriteVisitor; switch to MessageVisitor + sanitization.
    • Update module docs to document sanitization.
    • Add unit tests covering newline/whitespace handling, content preservation, and empty inputs.
  • Webserver:
    • Clean log lines by removing emojis in spawn_webapp_update_listener and Kafka shutdown messages in shutdown.

Written by Cursor Bugbot for commit 024836c. This will update automatically on new commits. Configure here.

Created using jj-spr 0.1.0
@vercel
Copy link

vercel bot commented Dec 4, 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 Dec 4, 2025 7:49pm
framework-docs Ready Ready Preview Comment Dec 4, 2025 7:49pm

// Collapse multiple spaces
let re = Regex::new(r"\s+").unwrap();
re.replace_all(&without_newlines, " ").trim().to_string()
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Regex compiled on every log message call

The sanitize_message function creates a new Regex object via Regex::new(r"\s+") on every invocation. Since this function is called for every log message in both text and JSON formatters, regex compilation happens on every single log call. Regex compilation is expensive. The regex pattern is constant and could be compiled once using lazy_static! or std::sync::LazyLock and reused, which the codebase already does elsewhere.

Fix in Cursor Fix in Web

@LucioFranco LucioFranco changed the title Clean up logs with typescript projects [2/n] Clean up logs with typescript projects Dec 4, 2025
Created using jj-spr 0.1.0
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