From 89fc326c7a118032ad1c0df355f72e49e90c5bed Mon Sep 17 00:00:00 2001
From: codershiba <155646804+codershiba@users.noreply.github.com>
Date: Sun, 14 Jan 2024 02:41:30 +0530
Subject: [PATCH] fix: destination docs and types (#1881)
---
docs/api.md | 10 ++++++----
pino.d.ts | 8 ++++----
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/docs/api.md b/docs/api.md
index 1c30deb3b..137afc35a 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -575,13 +575,15 @@ parent.child(bindings)
-### `destination` (SonicBoom | WritableStream | String | Object)
+### `destination` (Number | String | Object | DestinationStream | SonicBoomOpts | WritableStream)
Default: `pino.destination(1)` (STDOUT)
-The `destination` parameter, at a minimum must be an object with a `write` method.
-An ordinary Node.js `stream` can be passed as the destination (such as the result
-of `fs.createWriteStream`) but for peak log writing performance it is strongly
+The `destination` parameter can be a file descriptor, a file path, or an
+object with `dest` property pointing to a fd or path.
+An ordinary Node.js `stream` file descriptor can be passed as the
+destination (such as the result
+of `fs.createWriteStream`) but for peak log writing performance, it is strongly
recommended to use `pino.destination` to create the destination stream.
Note that the `destination` parameter can be the result of `pino.transport()`.
diff --git a/pino.d.ts b/pino.d.ts
index aedce4239..988a2b8e3 100644
--- a/pino.d.ts
+++ b/pino.d.ts
@@ -765,13 +765,13 @@ declare namespace pino {
/**
* Create a Pino Destination instance: a stream-like object with significantly more throughput (over 30%) than a standard Node.js stream.
- * @param [dest]: The `destination` parameter, at a minimum must be an object with a `write` method. An ordinary Node.js
- * `stream` can be passed as the destination (such as the result of `fs.createWriteStream`) but for peak log
- * writing performance it is strongly recommended to use `pino.destination` to create the destination stream.
+ * @param [dest]: The `destination` parameter, can be a file descriptor, a file path, or an object with `dest` property pointing to a fd or path.
+ * An ordinary Node.js `stream` file descriptor can be passed as the destination (such as the result of `fs.createWriteStream`)
+ * but for peak log writing performance, it is strongly recommended to use `pino.destination` to create the destination stream.
* @returns A Sonic-Boom stream to be used as destination for the pino function
*/
export function destination(
- dest?: string | number | SonicBoomOpts | DestinationStream | NodeJS.WritableStream,
+ dest?: number | object | string | DestinationStream | NodeJS.WritableStream | SonicBoomOpts,
): SonicBoom;
export function transport>(