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

docs(help): use formatters since useLevelLabels is deprecated #1533

Merged
merged 1 commit into from Aug 27, 2022

Conversation

arkerone
Copy link
Contributor

Since useLevelLabels option is deprecated, we can use the formatters option with a level function to format the level.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 548f257 into pinojs:master Aug 27, 2022
@arkerone arkerone deleted the doc/use-formatter-for-level-label branch August 27, 2022 21:30
@HengCC
Copy link

HengCC commented Mar 15, 2023

import pino from 'pino';
import { logURL, nodeName } from './config.js';

const logger = pino({
  level: "info",
  messageKey: "message",
  errorKey: "error",
  formatters: {
    level: (label) => {
      return { level: label }
    }
  },
  base: {
    APP_NAME: "xxxx,
    NODE_NAME: nodeName,
  },
  transport: {
    targets: [
      {
        target: 'pino-pretty',
        options: {
          colorize: true,
          singleLine: true,
        }
      },
      {
        target: 'pino-socket',
        options: {
          address: logURL,
          port: 5000,
          mode: 'tcp'
        },
      }
    ]
  }

});

export default logger;

this will cause an error , Error: option.transport.targets do not allow custom level formatters,

Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants