express-zod-api icon indicating copy to clipboard operation
express-zod-api copied to clipboard

winston detetction not sufficient

Open daniel-white opened this issue 1 year ago • 0 comments

Description

i'm trying to use pino over winston and I have to hack the logger instance to look not like the simpleified winston config.

  // HACK
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  (logger as any).color = undefined;

Without this, I get

X [MissingPeerError]: Missing peer dependency: winston. Please install it to use the feature.
    at ne (/Users/danielwhite/Repos/prism-service/node_modules/express-zod-api/dist/index.cjs:5:8015)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Mr (/Users/danielwhite/Repos/prism-service/node_modules/express-zod-api/dist/index.cjs:18:1169)
    at async Nr (/Users/danielwhite/Repos/prism-service/node_modules/express-zod-api/dist/index.cjs:18:1838)

Expected

I would not expect express-zod-api to allow pino with no modifications

Reproduction

import pino, { BaseLogger, LevelWithSilent, LoggerOption } from 'pino';

export function createLogger(level: LevelWithSilent): BaseLogger {
  const options: LoggerOptions = {
    level
  };
  const logger = pino(options);
  return logger;
}

Context

  • Node.js version: 20.11.1
  • express-zod-api version: 17.2.0

daniel-white avatar Mar 04 '24 19:03 daniel-white