|
24 | 24 | * [Statics](#statics)
|
25 | 25 | * [pino.destination()](#pino-destination)
|
26 | 26 | * [pino.transport()](#pino-transport)
|
27 |
| - * [pino.final()](#pino-final) |
28 | 27 | * [pino.multistream()](#pino-multistream)
|
29 | 28 | * [pino.stdSerializers](#pino-stdserializers)
|
30 | 29 | * [pino.stdTimeFunctions](#pino-stdtimefunctions)
|
@@ -1150,59 +1149,6 @@ For more on transports, how they work, and how to create them see the [`Transpor
|
1150 | 1149 | * `targets`: May be specified instead of `target`. Must be an array of transport configurations. Transport configurations include the aforementioned `options` and `target` options plus a `level` option which will send only logs above a specified level to a transport.
|
1151 | 1150 | * `pipeline`: May be specified instead of `target`. Must be an array of transport configurations. Transport configurations include the aforementioned `options` and `target` options. All intermediate steps in the pipeline _must_ be `Transform` streams and not `Writable`.
|
1152 | 1151 |
|
1153 |
| -<a id="pino-final"></a> |
1154 |
| -
|
1155 |
| -### `pino.final(logger, [handler]) => Function | FinalLogger` |
1156 |
| -
|
1157 |
| -__The use of `pino.final` is discouraged in Node.js v14+ and not required. |
1158 |
| -It will be removed in the next major version.__ |
1159 |
| -
|
1160 |
| -The `pino.final` method can be used to acquire a final logger instance |
1161 |
| -or create an exit listener function. This is _not_ needed in Node.js v14+ |
1162 |
| -as pino automatically can handle those. |
1163 |
| -
|
1164 |
| -The `finalLogger` is a specialist logger that synchronously flushes |
1165 |
| -on every write. This is important to guarantee final log writes, |
1166 |
| -when using `pino.destination({ sync: false })` target. |
1167 |
| -
|
1168 |
| -Since final log writes cannot be guaranteed with normal Node.js streams, |
1169 |
| -if the `destination` parameter of the `logger` supplied to `pino.final` |
1170 |
| -is a Node.js stream `pino.final` will throw. |
1171 |
| -
|
1172 |
| -The use of `pino.final` with `pino.destination` is not needed, as |
1173 |
| -`pino.destination` writes things synchronously. |
1174 |
| -
|
1175 |
| -#### `pino.final(logger, handler) => Function` |
1176 |
| -
|
1177 |
| -In this case the `pino.final` method supplies an exit listener function that can be |
1178 |
| -supplied to process exit events such as `exit`, `uncaughtException`, |
1179 |
| -`SIGHUP` and so on. |
1180 |
| -
|
1181 |
| -The exit listener function will call the supplied `handler` function |
1182 |
| -with an error object (or else `null`), a `finalLogger` instance followed |
1183 |
| -by any additional arguments the `handler` may be called with. |
1184 |
| -
|
1185 |
| -```js |
1186 |
| -process.on('uncaughtException', pino.final(logger, (err, finalLogger) => { |
1187 |
| - finalLogger.error(err, 'uncaughtException') |
1188 |
| - process.exit(1) |
1189 |
| -})) |
1190 |
| -``` |
1191 |
| -
|
1192 |
| -#### `pino.final(logger) => FinalLogger` |
1193 |
| -
|
1194 |
| -In this case the `pino.final` method returns a finalLogger instance. |
1195 |
| -
|
1196 |
| -```js |
1197 |
| -var finalLogger = pino.final(logger) |
1198 |
| -finalLogger.info('exiting...') |
1199 |
| -``` |
1200 |
| -
|
1201 |
| -* See [`destination` parameter](#destination) |
1202 |
| -* See [Exit logging help](/docs/help.md#exit-logging) |
1203 |
| -* See [Asynchronous logging ⇗](/docs/asynchronous.md) |
1204 |
| -* See [Log loss prevention ⇗](/docs/asynchronous.md#log-loss-prevention) |
1205 |
| -
|
1206 | 1152 | <a id="pino-multistream"></a>
|
1207 | 1153 |
|
1208 | 1154 | ### `pino.multistream(streamsArray, opts) => MultiStreamRes`
|
|
0 commit comments