feat(pino): allow customizing error logging - #1934
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
✅ 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 optionallogErrortoLoggingHandlerPluginOptionsand routes all threelogger.errorcall sites (internal/interceptor, business-logic, stream) throughthis.logError, defaulting to(logger, error) => logger.error(error). Business and stream sites gained anelse if (logger)guard, which is required to avoid callinglogError(undefined, error)when the context logger is absent.packages/pino/src/handler-plugin.test.ts: addswarnspy andLoggertype import; three new tests cover custom internal/business/stream error logging, plus assertions thatlogErroris not called on abort paths.apps/content/docs/integrations/pino.md: documentslogErrorin 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.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
What about this approach instead ##1949 ? |

Summary
logError(logger, error)option for customizing error payloads and log levelslogger.error(error)as the defaultTesting
pnpm vitest run packages/pino/src(14 passed)pnpm --filter @orpc/experimental-pino type:checkpnpm --filter @orpc/experimental-pino buildgit diff --checkFixes #1930