Truncate oversized log records#192
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a Monolog formatter decorator that caps oversized formatted log output at 240 KiB (to stay under Bref/PHP-FPM log limits) and wires it into the Cloud MonologTarget handler pipeline.
Changes:
- Added
craft\cloud\TruncatingFormatterto truncate oversized formatted records while preserving UTF-8 and terminal line endings. - Wrapped existing Monolog handler formatters with
TruncatingFormatterduringMonologTargetconstruction inAppConfig. - Added a focused unit test covering truncation behavior and CRLF preservation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/TruncatingFormatter.php |
New formatter decorator that truncates formatted log output to a safe byte limit. |
src/AppConfig.php |
Wraps handler formatters with the truncating decorator when creating MonologTarget. |
tests/unit/TruncatingFormatterTest.php |
Adds unit coverage for truncation, UTF-8 validity, and CRLF preservation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9277f64f5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Caps formatted Monolog records at 240 KiB before Craft streams them to Bref’s PHP-FPM runtime. The decorator preserves UTF-8 and terminal line endings while retaining each handler’s existing formatter, with focused CRLF coverage.