Skip to content

Commit 36399fa

Browse files
alecmevjsumners
authored andcommitted
Document setBindings
1 parent dbb394f commit 36399fa

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/api.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
* [logger.fatal()](#fatal)
1414
* [logger.silent()](#silent)
1515
* [logger.child()](#child)
16-
* [logger.bindings()](#bindings)
16+
* [logger.bindings()](#logger-bindings)
17+
* [logger.setBindings()](#logger-set-bindings)
1718
* [logger.flush()](#flush)
1819
* [logger.level](#logger-level)
1920
* [logger.isLevelEnabled()](#islevelenabled)
@@ -888,6 +889,7 @@ The log level of a child is mutable. It can be set independently
888889
of the parent either by setting the [`level`](#level) accessor after creating
889890
the child logger or using the [`options.level`](#optionslevel-string) key.
890891
892+
<a id="logger-child-bindings"></a>
891893
#### `bindings` (Object)
892894
893895
An object of key-value pairs to include in every log line output
@@ -978,7 +980,7 @@ child.info({test: 'will be overwritten'})
978980
* See [`serializers` option](#opt-serializers)
979981
* See [pino.stdSerializers](#pino-stdSerializers)
980982
981-
<a id="bindings"></a>
983+
<a id="logger-bindings"></a>
982984
### `logger.bindings()`
983985
984986
Returns an object containing all the current bindings, cloned from the ones passed in via `logger.child()`.
@@ -991,6 +993,16 @@ console.log(anotherChild.bindings())
991993
// { foo: 'bar', MIX: { IN: 'always' } }
992994
```
993995
996+
<a id="logger-set-bindings"></a>
997+
### `logger.setBindings(bindings)`
998+
999+
Adds to the bindings of this logger instance.
1000+
1001+
**Note:** Does not overwrite bindings. Can potentially result in duplicate keys in
1002+
log lines.
1003+
1004+
* See [`bindings` parameter in `logger.child`](#logger-child-bindings)
1005+
9941006
<a id="flush"></a>
9951007
### `logger.flush([cb])`
9961008

0 commit comments

Comments
 (0)