sainsburys-tech / next-logger

JSON logging patcher for Next.js
MIT License
144 stars 14 forks source link

rename to next-pino-logger? #17

Closed devinrhode2 closed 2 years ago

devinrhode2 commented 2 years ago

I think fundamental to next-logger, is the fact that it assumes you are using pino, right?

The biggest value I see in it is mapping console and nextLogger methods to pino methods, and also (trying) to mapping args accordingly, so it's very intrinsic to pino.

atkinchris commented 2 years ago

Thanks for the suggestion; I would be against a name change at this point. I think the current name (next-logger) conveys the function of this library and is not misleading (for example, it isn't called next-winston-logger, but uses pino).

The library currently has 14,000+ weekly downloads; I would not want to put these existing integrations into a place where they have to deal with a renamed dependency.

The default implementation of this library is pino, as a fast, popular choice for structured logging. However, it is not fundamentally restricted to pino. With version 3.0.0 in January, custom logging functions can be used; so any object with error, warn, trace and info methods can be used for logging, not just pino.

For example:

const winston = require('winston')

const logger = winston.createLogger({...})

const logger = () => ({
  error: logger.error,
  warn: logger.warn,
  trace: logger.trace,
  info: logger.info
})