pinojs / pino-pretty

🌲Basic prettifier for Pino log lines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change the way of passing customLevels in code level

ademarsj opened this issue · comments

Due to pino handle customLevels as object often people will try to use like that in pino-pretty, so receiving a object instead of a string when using in code level as a transporter in pino would improve the understanding and use of the lib.

To work like that, instead of transforming the object to string and keeping two instances who had the same value but in different types:

const levels = {
  http: 10,
  info: 30,
  debug: 35,
  warn: 40,
  normal_error: 50,
  fatal_error: 60,
}

const log = pino(
  {
    customLevels: levels,
    useOnlyCustomLevels: true,
    level: 'http'
  },
  pretty({
  colorize: true,
  levelFirst: true,
  customLevels: levels,
  })
);

I would like to work on that, so i will send a PR as soon as i can. (Sorry for closing the PR, i missed the click...)