Skip to content

feat(pino): allow customizing error logging - #1934

Closed
arhxam wants to merge 1 commit into
middleapi:1.xfrom
arhxam:codex/pino-custom-error-logging
Closed

feat(pino): allow customizing error logging#1934
arhxam wants to merge 1 commit into
middleapi:1.xfrom
arhxam:codex/pino-custom-error-logging

Conversation

@arhxam

@arhxam arhxam commented Aug 23, 2026

Copy link
Copy Markdown

Summary

  • add a logError(logger, error) option for customizing error payloads and log levels
  • apply it consistently to internal, business-logic, and stream failures while preserving logger.error(error) as the default
  • keep request aborts informational and document the callback semantics

Testing

  • pnpm vitest run packages/pino/src (14 passed)
  • pnpm --filter @orpc/experimental-pino type:check
  • pnpm --filter @orpc/experimental-pino build
  • ESLint on the changed source, tests, and documentation
  • git diff --check

Fixes #1930

@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orpc Ready Ready Preview Aug 23, 2026 11:43pm

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes — Extends the pino LoggingHandlerPlugin with a logError(logger, error) option for customizing error payloads and log levels.

  • packages/pino/src/handler-plugin.ts: adds the optional logError to LoggingHandlerPluginOptions and routes all three logger.error call sites (internal/interceptor, business-logic, stream) through this.logError, defaulting to (logger, error) => logger.error(error). Business and stream sites gained an else if (logger) guard, which is required to avoid calling logError(undefined, error) when the context logger is absent.
  • packages/pino/src/handler-plugin.test.ts: adds warn spy and Logger type import; three new tests cover custom internal/business/stream error logging, plus assertions that logError is not called on abort paths.
  • apps/content/docs/integrations/pino.md: documents logError in the sample and prose.

I verified the implementation routes all error-logging call sites through logError, preserves logger.error(error) as the default, and keeps business/stream aborts at info without invoking logError — consistent with the JSDoc and docs contract. I ran pnpm vitest run packages/pino/src (14 passed) and pnpm --filter @orpc/experimental-pino type:check (clean). The default and custom paths are both genuinely exercised; the new tests would fail if routing regressed to logger.error.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@dinwwwh

dinwwwh commented Aug 25, 2026

Copy link
Copy Markdown
Member

What about this approach instead ##1949 ?

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