Skip to content

List level before action in Stdout and Pretty exporters#6

Merged
loks0n merged 1 commit into
mainfrom
level-first
May 13, 2026
Merged

List level before action in Stdout and Pretty exporters#6
loks0n merged 1 commit into
mainfrom
level-first

Conversation

@loks0n

@loks0n loks0n commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reorder Stdout NDJSON output so level appears first, then action, then the remaining attributes
  • Reorder Pretty exporter attribute block so level is rendered first (action stays in the header)

Test plan

  • vendor/bin/phpunit tests/Exporter/ passes (26 tests)
  • Sample output confirmed: {"level":"info","action":"unknown",...}

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@loks0n loks0n merged commit 97f0ab6 into main May 13, 2026
7 checks passed
@greptile-apps

greptile-apps Bot commented May 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR reorders key fields in two span exporters so that level appears before action in output, making log lines easier to scan at a glance.

  • Stdout.php: Builds an explicit $ordered array (levelaction) before merging the remaining attributes, producing NDJSON of the form {\"level\":\"info\",\"action\":\"unknown\",...}.
  • Pretty.php: Uses the standard PHP unset-and-prepend idiom to hoist level to the front of the attribute display block; action already lives in the header and is unaffected.

Confidence Score: 5/5

Both changes are narrow and additive — they only reorder output keys and do not touch business logic, error handling, or sampling.

The two exporters each gain a small, self-contained block that hoists level to the front of the output. The existing action-first logic is preserved, level is correctly removed from the remaining attributes before the merge, and there are no silent drops or duplicates. No control flow, error paths, or public APIs are changed.

No files require special attention.

Important Files Changed

Filename Overview
src/Span/Exporter/Stdout.php Reorders NDJSON output: level (when present) is placed before action, then remaining attributes follow. Logic is correct — level is unset from attributes before merging so it appears exactly once.
src/Span/Exporter/Pretty.php Reorders the attribute display block so level renders first; action remains in the header. Standard PHP array-prepend idiom used correctly.

Reviews (1): Last reviewed commit: "List level before action in Stdout and P..." | Re-trigger Greptile

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.

1 participant