Skip to content

Commit 64672ee

Browse files
authoredOct 31, 2021
Mention the prettyPrint deprecation in the README. (#255)
1 parent cd44cdd commit 64672ee

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed
 

‎Readme.md

+27-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ Will format to:
2424
[1522431328992] INFO (42 on foo): hello world
2525
```
2626

27+
If you landed on this page due to the deprecation of the `prettyPrint` option
28+
of `pino`, read the [Programmatic Integration](#integration) section.
29+
2730
<a id="example"></a>
2831
## Example
2932

@@ -96,9 +99,6 @@ node app.js | pino-pretty
9699
We recommend against using `pino-pretty` in production and highly
97100
recommend installing `pino-pretty` as a development dependency.
98101

99-
When installed, `pino-pretty` will be used by `pino` as the default
100-
prettifier.
101-
102102
Install `pino-pretty` alongside `pino` and set the transport target to `'pino-pretty'`:
103103

104104
```js
@@ -128,6 +128,29 @@ const logger = pino({
128128
logger.info('hi')
129129
```
130130

131+
Use it as a stream:
132+
133+
```js
134+
const pino = require('pino')
135+
const pretty = require('pino-pretty')
136+
const logger = pino(pretty())
137+
138+
logger.info('hi')
139+
```
140+
141+
Options are also supported:
142+
143+
```js
144+
const pino = require('pino')
145+
const pretty = require('pino-pretty')
146+
const stream = pretty({
147+
prettyPrint: { colorize: true }
148+
})
149+
const logger = pino(stream)
150+
151+
logger.info('hi')
152+
```
153+
131154
See the [Options](#options) section for all possible options.
132155

133156
### Handling non-serializable options
@@ -167,9 +190,7 @@ module.exports = opts => require('pino-pretty')({
167190
<a id="options"></a>
168191
### Options
169192

170-
`pino-pretty` exports a factory function that can be used to format log strings.
171-
This factory function is used internally by Pino, and accepts an options argument
172-
with keys corresponding to the options described in [CLI Arguments](#cliargs):
193+
The options accepted have keys corresponding to the options described in [CLI Arguments](#cliargs):
173194

174195
```js
175196
{

0 commit comments

Comments
 (0)
Please sign in to comment.