From 68b920d090fc386a031ca2177882068b628f9d9a Mon Sep 17 00:00:00 2001 From: Maksim Date: Sat, 9 Apr 2022 20:18:18 +0400 Subject: [PATCH 1/4] replace extreme destination with async destination `extreme` destination does not exist on `pino` anymore --- docs/legacy.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/legacy.md b/docs/legacy.md index 5848f6967..261f17d2b 100644 --- a/docs/legacy.md +++ b/docs/legacy.md @@ -59,8 +59,8 @@ uses the high speed [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom) l #### Extreme Mode -The `extreme` setting does not exist as an option in Pino v5, instead use -a `pino.extreme` destination. +The `extreme` mode does not exist as an option in Pino v5, instead use +[asynchronous logging](/docs/asynchronous.md). ##### v4 @@ -73,13 +73,13 @@ const fileLogger = require('pino')({extreme: true}, fs.createWriteStream('/log/p ##### v5 ```js -const stdoutLogger = require('pino')(pino.extreme()) -const stderrLogger = require('pino')(pino.extreme(2)) -const fileLogger = require('pino')(pino.extreme('/log/path')) +const stdoutLogger = require('pino')(pino.destination({sync: false, minLength: 4096})) +const stderrLogger = require('pino')(pino.destination({dest: 2, sync: false, minLength: 4096})) +const fileLogger = require('pino')(pino.destination({dest: '/log/path', sync: false, minLength: 4096})) ``` -* See [pino.extreme](/docs/api.md#pino-extreme) -* See [Extreme mode ⇗](/docs/extreme.md) +* See [`destination` parameter](/docs/api.md#destination) +* See [Asynchronous Logging ⇗](/docs/asynchronous.md) #### Pino CLI is now pino-pretty CLI From b3d4f418ba9cfaf8628bbc52c752d4cdd5f6d154 Mon Sep 17 00:00:00 2001 From: Maksim Date: Sat, 9 Apr 2022 22:22:04 +0400 Subject: [PATCH 2/4] delete Legacy.md as it's about a very old version see https://github.com/pinojs/pino/pull/1402#pullrequestreview-937159616 --- docs/legacy.md | 167 ------------------------------------------------- 1 file changed, 167 deletions(-) delete mode 100644 docs/legacy.md diff --git a/docs/legacy.md b/docs/legacy.md deleted file mode 100644 index 261f17d2b..000000000 --- a/docs/legacy.md +++ /dev/null @@ -1,167 +0,0 @@ -# Legacy - -## Legacy Node Support - -### Node v4 - -Node v4 is supported on the [Pino v4](#pino-v4-documentation) line. - -### Node v0.10-v0.12 - -Node v0.10 or Node v0.12 is supported on the [Pino v2](#pino-v2-documentation) line. - -## Documentation - -### Pino v4 Documentation - - - -### Pino v3 Documentation - - - -### Pino v2 Documentation - - - -## Migration - -### Pino v4 to Pino v5 - -#### Logging Destination - -In Pino v4 the destination could be set by passing a stream as the -second parameter to the exported `pino` function. This is still the -case in v5. However it's strongly recommended to use `pino.destination` -which will write logs ~30% faster. - -##### v4 - -```js -const stdoutLogger = require('pino')() -const stderrLogger = require('pino')(process.stderr) -const fileLogger = require('pino')(fs.createWriteStream('/log/path')) -``` - -##### v5 - -```js -const stdoutLogger = require('pino')() // pino.destination by default -const stderrLogger = require('pino')(pino.destination(2)) -const fileLogger = require('pino')(pino.destination('/log/path')) -``` - -Note: This is not a breaking change, `WritableStream` instances are still -supported, but are slower than `pino.destination` which -uses the high speed [`sonic-boom` ⇗](https://github.com/mcollina/sonic-boom) library. - -* See [`destination` parameter](/docs/api.md#destination) - -#### Extreme Mode - -The `extreme` mode does not exist as an option in Pino v5, instead use -[asynchronous logging](/docs/asynchronous.md). - -##### v4 - -```js -const stdoutLogger = require('pino')({extreme: true}) -const stderrLogger = require('pino')({extreme: true}, process.stderr) -const fileLogger = require('pino')({extreme: true}, fs.createWriteStream('/log/path')) -``` - -##### v5 - -```js -const stdoutLogger = require('pino')(pino.destination({sync: false, minLength: 4096})) -const stderrLogger = require('pino')(pino.destination({dest: 2, sync: false, minLength: 4096})) -const fileLogger = require('pino')(pino.destination({dest: '/log/path', sync: false, minLength: 4096})) -``` - -* See [`destination` parameter](/docs/api.md#destination) -* See [Asynchronous Logging ⇗](/docs/asynchronous.md) - - -#### Pino CLI is now pino-pretty CLI - -The Pino CLI is provided with Pino v4 for basic log prettification. - -From Pino v5 the CLI is installed separately with `pino-pretty`. - -##### v4 -```sh -$ npm install -g pino -$ node app.js | pino -``` - -##### v5 -```sh -$ npm install -g pino-pretty -$ node app.js | pino-pretty -``` - -* See [Pretty Printing documentation](/docs/pretty.md) - -#### Programmatic Pretty Printing - -The [`pino.pretty()`](https://github.com/pinojs/pino/blob/v4.x.x/docs/API.md#prettyoptions) -method has also been removed from Pino v5. - -##### v4 - -```js -var pino = require('pino') -var pretty = pino.pretty() -pretty.pipe(process.stdout) -``` - -##### v5 - -Instead use the `prettyPrint` option (also available in v4): - -```js -const logger = require('pino')({ - prettyPrint: process.env.NODE_ENV !== 'production' -}) -``` - -In v5 the `pretty-print` module must be installed to use the `prettyPrint` option: - -```sh -npm install --save-dev pino-pretty -``` - -* See [prettyPrint option](/docs/api.md#prettyPrint) -* See [Pretty Printing documentation](/docs/pretty.md) - -#### Slowtime - -In Pino v4 a `slowtime` option was supplied, which allowed for full ISO dates -in the timestamps instead of milliseconds since the Epoch. In Pino v5 this -has been completely removed, along with the `pino.stdTimeFunctions.slowTime` -function. In order to achieve the equivalent in v5, a custom -time function should be supplied: - -##### v4 - -```js -const pino = require('pino') -const logger = pino({slowtime: true}) -// following avoids deprecation warning in v4: -const loggerAlt = pino({timestamp: pino.stdTimeFunctions.slowTime}) -``` - -##### v5 - -```js -const logger = require('pino')({ - timestamp: () => ',"time":"' + (new Date()).toISOString() + '"' -}) -``` - -The practice of creating ISO dates in-process for logging purposes is strongly -recommended against. Instead consider post-processing the logs or using a transport -to convert the timestamps. - - -* See [timestamp option](/docs/api.md#timestamp) From 1dad93e5c982493edc08ce2e7c59efc831bbcabc Mon Sep 17 00:00:00 2001 From: Maksim Date: Sat, 9 Apr 2022 23:01:02 +0400 Subject: [PATCH 3/4] remove legacy.md the section was about a very old version and better be deleted --- docsify/sidebar.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docsify/sidebar.md b/docsify/sidebar.md index 7a22254ad..9e502de9c 100644 --- a/docsify/sidebar.md +++ b/docsify/sidebar.md @@ -9,7 +9,6 @@ * [Asynchronous Logging](/docs/asynchronous.md) * [Ecosystem](/docs/ecosystem.md) * [Benchmarks](/docs/benchmarks.md) -* [Legacy](/docs/legacy.md) * [Long Term Support](/docs/lts.md) * [Help](/docs/help.md) * [Exit logging](/docs/help.md#exit-logging) From 315d02931922113f99940ad832df32fc479fa76d Mon Sep 17 00:00:00 2001 From: Maksim Date: Sat, 9 Apr 2022 23:02:17 +0400 Subject: [PATCH 4/4] remove legacy section the section was about a very old version and better be deleted --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index fa20928e3..9d09c0580 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ * [Pretty Printing ⇗](/docs/pretty.md) * [Asynchronous Logging ⇗](/docs/asynchronous.md) * [Ecosystem ⇗](/docs/ecosystem.md) -* [Legacy](/docs/legacy.md) * [Help ⇗](/docs/help.md) * [Long Term Support Policy ⇗](/docs/lts.md)