Skip to content

Forbid using default log levels when useOnlyCustomLevels: true #1998

@chernodub

Description

@chernodub

Currently, pino's TS declaration allows using default log levels when useOnlyCustomLevels is true. This following code will result in a runtime error:

import { pino } from 'pino';

const logger = pino({
  customLevels: { customInfo: 10 },
  useOnlyCustomLevels: true,
});

logger.info('123'); // TS should warn here ?
logger.customInfo('123'); // should work fine

Expected behavior:

import { pino } from 'pino';

const logger = pino({
  customLevels: { customInfo: 10 },
  useOnlyCustomLevels: true,
});

logger.info('123'); // TS errors here
logger.customInfo('123'); // works fine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions