{"record":{"id":"35afede962fec4b7","repo":"pinojs/pino","slug":"prettyprint-option-is-no-longer-supported-see-the","errorCode":null,"errorMessage":"prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)","messagePattern":"prettyPrint option is no longer supported, see the pino-pretty package \\(https://github\\.com/pinojs/pino-pretty\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/tools.js","lineNumber":356,"sourceCode":"      if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {\n        throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)')\n      }\n      if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === 'function') {\n        throw Error('option.transport.targets do not allow custom level formatters')\n      }\n\n      let customLevels\n      if (opts.customLevels) {\n        customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels)\n      }\n      stream = transport({ caller, ...opts.transport, levels: customLevels })\n    }\n    opts = Object.assign({}, defaultOptions, opts)\n    opts.serializers = Object.assign(Object.create(null), defaultOptions.serializers, opts.serializers)\n    opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters)\n\n    if (opts.prettyPrint) {\n      throw new Error('prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)')\n    }\n\n    const { enabled, onChild } = opts\n    if (enabled === false) opts.level = 'silent'\n    if (!onChild) opts.onChild = noop\n    if (!stream) {\n      if (!hasBeenTampered(process.stdout)) {\n        // If process.stdout.fd is undefined, it means that we are running\n        // in a worker thread. Let's assume we are logging to file descriptor 1.\n        stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 })\n      } else {\n        stream = process.stdout\n      }\n    }\n    return { opts, stream }\n  }\n}\n","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/pinojs/pino/blob/5aa62305c57709ebd6f6b7c328e8830eeb29b297/lib/tools.js#L338-L374","documentation":"The prettyPrint option was removed in pino v7+. createArgsNormalizer (lib/tools.js:356) rejects it outright and directs users to the standalone pino-pretty package, because pretty-printing is now handled as a transport rather than an in-process option.","triggerScenarios":"Passing pino({ prettyPrint: true }) or any truthy prettyPrint object to pino() or pino.destination().","commonSituations":"Upgrading from pino v6 or earlier to v7+; copying old tutorials or config; enabling pretty logs in production code that was written against the legacy API.","solutions":["Remove the prettyPrint option and use a transport: pino({ transport: { target: 'pino-pretty' } })","Pipe output through the pino-pretty CLI: node app.js | pino-pretty","Pin pino v6 only if you cannot migrate (not recommended)"],"exampleFix":"// before\nconst logger = pino({ prettyPrint: { colorize: true } });\n// after\nconst logger = pino({ transport: { target: 'pino-pretty', options: { colorize: true } } });","handlingStrategy":"validation","validationCode":"function assertNoPrettyPrint(opts = {}) {\n  if ('prettyPrint' in opts) {\n    throw new Error('prettyPrint was removed in pino v7; use transport with pino-pretty');\n  }\n}","typeGuard":"function usesLegacyPrettyPrint(opts) { return typeof opts === 'object' && opts !== null && 'prettyPrint' in opts; }","tryCatchPattern":"try { logger = pino(opts); } catch (e) { if (/prettyPrint option is no longer supported/.test(e.message)) { logger = pino({ transport: { target: 'pino-pretty' } }); } else { throw e; } }","preventionTips":["Audit options objects when upgrading pino major versions","Use pino-pretty as a transport target or CLI pipe instead","Centralize logger construction in one module so deprecated options are removed in one place"],"tags":["logging","pino","breaking-change","migration"],"backgroundTag":"removed-option","analyzedSha":"5aa62305c57709ebd6f6b7c328e8830eeb29b297","analyzedAt":"2026-09-02T22:05:21.418Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}