@@ -24,6 +24,9 @@ Will format to:
24
24
[1522431328992] INFO (42 on foo): hello world
25
25
```
26
26
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
+
27
30
<a id =" example " ></a >
28
31
## Example
29
32
@@ -96,9 +99,6 @@ node app.js | pino-pretty
96
99
We recommend against using ` pino-pretty ` in production and highly
97
100
recommend installing ` pino-pretty ` as a development dependency.
98
101
99
- When installed, ` pino-pretty ` will be used by ` pino ` as the default
100
- prettifier.
101
-
102
102
Install ` pino-pretty ` alongside ` pino ` and set the transport target to ` 'pino-pretty' ` :
103
103
104
104
``` js
@@ -128,6 +128,29 @@ const logger = pino({
128
128
logger .info (' hi' )
129
129
```
130
130
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
+
131
154
See the [ Options] ( #options ) section for all possible options.
132
155
133
156
### Handling non-serializable options
@@ -167,9 +190,7 @@ module.exports = opts => require('pino-pretty')({
167
190
<a id =" options " ></a >
168
191
### Options
169
192
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 ) :
173
194
174
195
``` js
175
196
{
0 commit comments