Skip to content

Commit 89fc326

Browse files
author
codershiba
authored
fix: destination docs and types (#1881)
1 parent 61cca12 commit 89fc326

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

docs/api.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,15 @@ parent.child(bindings)
575575
576576
577577
<a id="destination"></a>
578-
### `destination` (SonicBoom | WritableStream | String | Object)
578+
### `destination` (Number | String | Object | DestinationStream | SonicBoomOpts | WritableStream)
579579
580580
Default: `pino.destination(1)` (STDOUT)
581581
582-
The `destination` parameter, at a minimum must be an object with a `write` method.
583-
An ordinary Node.js `stream` can be passed as the destination (such as the result
584-
of `fs.createWriteStream`) but for peak log writing performance it is strongly
582+
The `destination` parameter can be a file descriptor, a file path, or an
583+
object with `dest` property pointing to a fd or path.
584+
An ordinary Node.js `stream` file descriptor can be passed as the
585+
destination (such as the result
586+
of `fs.createWriteStream`) but for peak log writing performance, it is strongly
585587
recommended to use `pino.destination` to create the destination stream.
586588
Note that the `destination` parameter can be the result of `pino.transport()`.
587589

pino.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -765,13 +765,13 @@ declare namespace pino {
765765

766766
/**
767767
* Create a Pino Destination instance: a stream-like object with significantly more throughput (over 30%) than a standard Node.js stream.
768-
* @param [dest]: The `destination` parameter, at a minimum must be an object with a `write` method. An ordinary Node.js
769-
* `stream` can be passed as the destination (such as the result of `fs.createWriteStream`) but for peak log
770-
* writing performance it is strongly recommended to use `pino.destination` to create the destination stream.
768+
* @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.
769+
* An ordinary Node.js `stream` file descriptor can be passed as the destination (such as the result of `fs.createWriteStream`)
770+
* but for peak log writing performance, it is strongly recommended to use `pino.destination` to create the destination stream.
771771
* @returns A Sonic-Boom stream to be used as destination for the pino function
772772
*/
773773
export function destination(
774-
dest?: string | number | SonicBoomOpts | DestinationStream | NodeJS.WritableStream,
774+
dest?: number | object | string | DestinationStream | NodeJS.WritableStream | SonicBoomOpts,
775775
): SonicBoom;
776776

777777
export function transport<TransportOptions = Record<string, any>>(

0 commit comments

Comments
 (0)