diff --git a/pino.d.ts b/pino.d.ts index 85d9d080f..a29952460 100644 --- a/pino.d.ts +++ b/pino.d.ts @@ -730,18 +730,6 @@ declare namespace P { type Logger = BaseLogger & LoggerExtras & Record; interface BaseLogger { - /** - * Creates a child logger, setting all key-value pairs in `bindings` as properties in the log lines. All serializers will be applied to the given pair. - * Child loggers use the same output stream as the parent and inherit the current log level of the parent at the time they are spawned. - * From v2.x.x the log level of a child is mutable (whereas in v1.x.x it was immutable), and can be set independently of the parent. - * If a `level` property is present in the object passed to `child` it will override the child logger level. - * - * @param bindings: an object of key-value pairs to include in log lines as properties. - * @param options: an options object that will override child logger inherited options. - * @returns a child logger instance. - */ - child(bindings: Bindings, options?: ChildLoggerOptions): BaseLogger; - /** * Set this property to the desired logging level. In order of priority, available levels are: * @@ -850,6 +838,18 @@ declare namespace P { */ levelVal: number; + /** + * Creates a child logger, setting all key-value pairs in `bindings` as properties in the log lines. All serializers will be applied to the given pair. + * Child loggers use the same output stream as the parent and inherit the current log level of the parent at the time they are spawned. + * From v2.x.x the log level of a child is mutable (whereas in v1.x.x it was immutable), and can be set independently of the parent. + * If a `level` property is present in the object passed to `child` it will override the child logger level. + * + * @param bindings: an object of key-value pairs to include in log lines as properties. + * @param options: an options object that will override child logger inherited options. + * @returns a child logger instance. + */ + child(bindings: Bindings, options?: ChildLoggerOptions): Logger; + /** * Registers a listener function that is triggered when the level is changed. * Note: When browserified, this functionality will only be available if the `events` module has been required elsewhere diff --git a/test/types/pino.test-d.ts b/test/types/pino.test-d.ts index b6369a808..b3c934bca 100644 --- a/test/types/pino.test-d.ts +++ b/test/types/pino.test-d.ts @@ -93,7 +93,7 @@ child.level = "info"; child.info("hooray"); log.info("nope nope nope"); log.child({ foo: "bar" }, { level: "debug" }).debug("debug!"); -(child as Logger).bindings(); +child.bindings(); const customSerializers = { test() { return "this is my serializer";