Skip to content

Commit 8d67c43

Browse files
committed
doc: address review feedback on logger.md
1 parent c6384d8 commit 8d67c43

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

doc/api/logger.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ logger.fatal(new Error('Unrecoverable error'));
306306
added: REPLACEME
307307
-->
308308

309+
> Stability: 1.1 - Active Development
310+
309311
* `bindings` {Object} Additional context fields for the child logger.
310312
* `options` {Object}
311313
* `level` {string} Log level for the child logger.
@@ -383,6 +385,18 @@ added: REPLACEME
383385
The `LogConsumer` class is the base class for log consumers. Consumers
384386
subscribe to `diagnostics_channel` events and process log records.
385387
388+
One channel is published per log level. The channel names are:
389+
390+
* `log:trace`
391+
* `log:debug`
392+
* `log:info`
393+
* `log:warn`
394+
* `log:error`
395+
* `log:fatal`
396+
397+
Advanced users may subscribe to these channels directly via
398+
`diagnostics_channel.channel(name)` instead of using a `LogConsumer`.
399+
386400
### `new LogConsumer([options])`
387401
388402
<!-- YAML
@@ -560,6 +574,11 @@ JSON-serializable will cause an error at log time:
560574
* Functions are silently omitted by `JSON.stringify()`.
561575
* Circular references throw a `TypeError`.
562576
577+
`Error` objects are an exception: the built-in `err` serializer runs by
578+
default and converts them to plain objects (with `type`, `message`, `stack`,
579+
and a recursively serialized `cause`) before they reach `JSON.stringify()`,
580+
so logging errors directly does not trigger the issues above.
581+
563582
To log `BigInt` values, convert them to strings or numbers first:
564583
565584
```js

0 commit comments

Comments
 (0)