Skip to content

Commit

Permalink
Document setBindings
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmev authored and jsumners committed Mar 19, 2024
1 parent dbb394f commit 36399fa
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* [logger.fatal()](#fatal)
* [logger.silent()](#silent)
* [logger.child()](#child)
* [logger.bindings()](#bindings)
* [logger.bindings()](#logger-bindings)
* [logger.setBindings()](#logger-set-bindings)
* [logger.flush()](#flush)
* [logger.level](#logger-level)
* [logger.isLevelEnabled()](#islevelenabled)
Expand Down Expand Up @@ -888,6 +889,7 @@ The log level of a child is mutable. It can be set independently
of the parent either by setting the [`level`](#level) accessor after creating
the child logger or using the [`options.level`](#optionslevel-string) key.
<a id="logger-child-bindings"></a>
#### `bindings` (Object)
An object of key-value pairs to include in every log line output
Expand Down Expand Up @@ -978,7 +980,7 @@ child.info({test: 'will be overwritten'})
* See [`serializers` option](#opt-serializers)
* See [pino.stdSerializers](#pino-stdSerializers)
<a id="bindings"></a>
<a id="logger-bindings"></a>
### `logger.bindings()`
Returns an object containing all the current bindings, cloned from the ones passed in via `logger.child()`.
Expand All @@ -991,6 +993,16 @@ console.log(anotherChild.bindings())
// { foo: 'bar', MIX: { IN: 'always' } }
```
<a id="logger-set-bindings"></a>
### `logger.setBindings(bindings)`
Adds to the bindings of this logger instance.
**Note:** Does not overwrite bindings. Can potentially result in duplicate keys in
log lines.
* See [`bindings` parameter in `logger.child`](#logger-child-bindings)
<a id="flush"></a>
### `logger.flush([cb])`
Expand Down

0 comments on commit 36399fa

Please sign in to comment.