Skip to content

docs: clarify custom reporter arguments and context - #469

Open
lxj808624 wants to merge 1 commit into
unjs:mainfrom
lxj808624:docs/reporter-args-context
Open

lxj808624 wants to merge 1 commit into
unjs:mainfrom
lxj808624:docs/reporter-args-context

Conversation

@lxj808624

@lxj808624 lxj808624 commented Dec 1, 2026 •

Copy link
Copy Markdown

Clarify the custom reporter method signature and the normalization of structured message input. This matches ConsolaReporter in src/types.ts and the behavior discussed in #406.

This documentation-only change is independent of #407's type correction and #455's OpenTelemetry example.

Validation: ran a custom reporter against the published consola 3.4.2 package on Node 22. Verified that a structured input with message "hello" and args [42] produces args ["hello", 42], no separate message property, and the second context argument contains options. git diff --check passed; the full test suite was not run.

AI disclosure: ChatGPT investigated, authored, and tested this documentation correction autonomously on behalf of @lxj808624.

Summary by CodeRabbit

  • Documentation
    • Clarified the custom reporter’s log method signature and return value.
    • Updated guidance on reading log arguments and handling structured messages.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The README now documents the custom reporter’s log(logObject, context) method, the options in context, and how a nonempty structured message is prepended to logObject.args.

Changes: Custom reporter documentation

Layer / File(s) Summary
Document reporter contract
README.md
The README changes the documented method to log(logObject, context) returning void. It explains that context contains logger options and reporters should read arguments from logObject.args.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Possibly related PRs

  • unjs/consola#468: This PR changes the reporter message field. The README documents the related structured-input behavior.

Suggested reviewers: pi0

Merge Risk: Minimal · up to cce09

This documentation-only change clarifies the custom reporter method signature and how structured messages are passed to reporters. It does not alter runtime behavior, so there is no meaningful merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "docs: clarify custom reporter arguments and context" matches the change. The README now documents that the custom reporter's log(logObject, context) method returns void, that context holds …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "docs: clarify custom reporter arguments and context" matches the change. The README now documents that the custom reporter's log(logObject, context) method returns void, that context holds the logger options, and that arguments are read from logObject.args, with a nonempty message prepended. The PR objectives describe the same documentation-only clarification of the reporter signature and structured message normalization. The title names the main change and is specific enough for a teammate scanning history.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 287d3244-0a01-4913-966d-04188051893f
Commits

Reviewing files that changed from the base of the PR and between c47faac and cce094a.

Files selected for processing: 1

  • README.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

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