Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serializers are applied twice in pino/browser #1970

Closed
emmyakin opened this issue May 9, 2024 · 2 comments · Fixed by #1971
Closed

serializers are applied twice in pino/browser #1970

emmyakin opened this issue May 9, 2024 · 2 comments · Fixed by #1971

Comments

@emmyakin
Copy link
Contributor

emmyakin commented May 9, 2024

Given the following configuration

let logger = pino({
    serializers: {
      extras(data) {
        return { serializedExtras: data };
      },
    },
    browser: {
      serialize: ['!stdSerializers.err', 'extras'],
      transmit: {
        level: 'info',
        send(level, logEvent) {
          console.log(JSON.stringify(logEvent));
        },
      },
    },
  })

 logger.info('This is an info', {
      extras: { a: 1 },
    })

the log is written as

{"ts":1715273299461,"messages":["This is an info",{"extras":{"serializedExtras":{"serializedExtras":{"a":1}}}}],"bindings":[],"level":{"label":"info","value":30}}

serializedExtras is nested twice in the log

@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@emmyakin
Copy link
Contributor Author

Sure, raised a PR #1971

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants