Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: destination docs and types #1881

Merged
merged 1 commit into from Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,15 @@ parent.child(bindings)


<a id="destination"></a>
### `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()`.

Expand Down
8 changes: 4 additions & 4 deletions pino.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TransportOptions = Record<string, any>>(
Expand Down
Loading