diff --git a/docs/pretty.md b/docs/pretty.md index 9afb8647d..3b03d4f22 100644 --- a/docs/pretty.md +++ b/docs/pretty.md @@ -62,40 +62,12 @@ will be written to the destination stream. > be easily investigated at a later date. 1. Install a prettifier module as a separate dependency, e.g. `npm install pino-pretty`. -1. Instantiate the logger with pretty printing enabled: +1. Instantiate the logger with the prettifier option: ```js const pino = require('pino') const log = pino({ - prettyPrint: { - levelFirst: true - }, prettifier: require('pino-pretty') }) ``` - Note: the default prettifier module is `pino-pretty`, so the preceding - example could be: - ```js - const pino = require('pino') - const log = pino({ - prettyPrint: { - levelFirst: true - } - }) - ``` - See the [`pino-pretty` documentation][pp] for more information on the options - that can be passed via `prettyPrint`. - -The default prettifier write stream does not guarantee final log writes. -Correspondingly, a warning is written to logs on the first synchronous flushing. -This warning may be suppressed by passing `suppressFlushSyncWarning : true` to -`prettyPrint`: - ```js - const pino = require('pino') - const log = pino({ - prettyPrint: { - suppressFlushSyncWarning: true - } - }) - ``` [pp]: https://github.com/pinojs/pino-pretty diff --git a/pino.d.ts b/pino.d.ts index ffd09439d..4dae0d7b8 100644 --- a/pino.d.ts +++ b/pino.d.ts @@ -17,8 +17,6 @@ // TypeScript Version: 4.4 import type { EventEmitter } from "events"; -// @ts-ignore -- gracefully falls back to `any` if not installed -import type { PrettyOptions as PinoPrettyOptions } from "pino-pretty"; import * as pinoStdSerializers from "pino-std-serializers"; import type { SonicBoom, SonicBoomOpts } from "sonic-boom"; import type { WorkerOptions } from "worker_threads"; @@ -318,8 +316,6 @@ declare namespace pino { (msg: string, ...args: any[]): void; } - interface PrettyOptions extends PinoPrettyOptions {} - interface LoggerOptions { transport?: TransportSingleOptions | TransportMultiOptions | TransportPipelineOptions /** @@ -405,11 +401,6 @@ declare namespace pino { * The string key to place any logged object under. */ nestedKey?: string; - /** - * Enables pino.pretty. This is intended for non-production configurations. This may be set to a configuration - * object as outlined in http://getpino.io/#/docs/API?id=pretty. Default: `false`. - */ - prettyPrint?: boolean | PrettyOptions; /** * Allows to optionally define which prettifier module to use. */ @@ -828,7 +819,6 @@ export interface LogFn extends pino.LogFn {} export interface LoggerOptions extends pino.LoggerOptions {} export interface MultiStreamOptions extends pino.MultiStreamOptions {} export interface MultiStreamRes extends pino.MultiStreamRes {} -export interface PrettyOptions extends pino.PrettyOptions {} export interface StreamEntry extends pino.StreamEntry {} export interface TransportBaseOptions extends pino.TransportBaseOptions {} export interface TransportMultiOptions extends pino.TransportMultiOptions {} diff --git a/test/types/pino.test-d.ts b/test/types/pino.test-d.ts index f103d6587..ad4797396 100644 --- a/test/types/pino.test-d.ts +++ b/test/types/pino.test-d.ts @@ -192,32 +192,6 @@ anotherRedacted.info({ anotherPath: "Not shown", }); -const pretty = pino({ - prettyPrint: { - colorize: true, - crlf: false, - errorLikeObjectKeys: ["err", "error"], - errorProps: "", - messageFormat: false, - ignore: "", - levelFirst: false, - messageKey: "msg", - timestampKey: "timestamp", - translateTime: "UTC:h:MM:ss TT Z", - }, -}); - -const withMessageFormatFunc = pino({ - prettyPrint: { - ignore: "requestId", - messageFormat: (log, messageKey: string) => { - const message = log[messageKey] as string; - if (log.requestId) return `[${log.requestId}] ${message}`; - return message; - }, - }, -}); - const withTimeFn = pino({ timestamp: pino.stdTimeFunctions.isoTime, });