fastify / fastify/fastify-cli

Can't use pino logger "The logger instance should have these functions"

Open
#618 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
733
Forks
177
Avg merge
1d 20h
Merged PRs (30d)
3

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported

### Fastify version

4.15.0

### Plugin version

4.0.0

### Node.js version

18.13

### Operating system

macOS

### Operating system version (i.e. 20.04, 11.3, 10)

13.2

### Description

Since upgrading to 4.15.0, my fastify api can't boot anymore.
It throws: `Invalid logger object provided. The logger instance should have these functions(s): 'child'`

I use Pino, so the one logger that is recommended.

Change was probably introduced here:
https://github.com/fastify/fastify/issues/4657
https://github.com/fastify/fastify/pull/4520

Bug is probably related to:
https://github.com/fastify/fastify-cli/issues/574

Honestly I don't know, between fastify and cli, who's responsible for this bug report, feel free to move it.

### Steps to Reproduce

```ts
# Logger.ts
import { pino } from 'pino';

export const logger = pino({
level: 'info',
});

# app.ts
export const options: FastifyServerOptions = {
logger,
};
```

```
fastify start --logging-module='build/logger.js' -o -w -P build/app.js
```

### Expected Behavior

Working

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.