Skip to content

fix: preserve raw flag for queued logs - #433

Open
MFA-G wants to merge 1 commit into
unjs:mainfrom
MFA-G:fix/resume-raw-queued-logs
Open

fix: preserve raw flag for queued logs#433
MFA-G wants to merge 1 commit into
unjs:mainfrom
MFA-G:fix/resume-raw-queued-logs

Conversation

@MFA-G

@MFA-G MFA-G commented Jun 29, 2026

Copy link
Copy Markdown

Fixes #429.

Summary

  • pass the queued raw flag back into _logFn when resumeLogs() drains paused logs
  • add a regression test for a queued warn.raw(...) call so log-object-shaped arguments stay in args

Validation

  • pnpm test

Summary by CodeRabbit

  • Bug Fixes
    • Fixed paused log replay so queued messages keep their full details when logging resumes.
    • Raw log entries are now preserved correctly after being queued during a pause.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 31d4096f-2c0a-430d-a28f-8d7c3fde1f03

📥 Commits

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

📒 Files selected for processing (2)
  • src/consola.ts
  • test/consola.test.ts

📝 Walkthrough

Walkthrough

resumeLogs() in consola.ts now passes the fourth queued element (isRaw) to _logFn when replaying buffered log entries, matching how _wrapLogFn stores them. A new test verifies that warn.raw calls queued during a pause are correctly emitted on resume.

Fix: isRaw flag preservation in resumeLogs

Layer / File(s) Summary
Pass isRaw on replay + regression test
src/consola.ts, test/consola.test.ts
resumeLogs() now calls _logFn(item[1], item[2], item[3]) instead of omitting item[3], restoring the isRaw flag for queued raw log calls. A new Vitest test pauses logging, emits warn.raw, resumes, and asserts the reporter received exactly one entry with the raw message payload.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny queued a warning raw,
but resume dropped it—what a flaw!
Now item three rides along too,
isRaw restored, the log shines through.
🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving the raw flag for queued logs.
Linked Issues check ✅ Passed The change forwards isRaw during resumeLogs() and adds a regression test for queued raw log calls, matching #429.
Out of Scope Changes check ✅ Passed The only code and test changes directly support preserving raw queued logs, with no unrelated additions.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

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.

resumeLogs() drops the isRaw flag for queued logs

1 participant