Skip to content

Consider using pino instead of winston for logging #709

Closed as not planned
Closed as not planned

Description

@0x2b3bfa0

It could be a better option, not only because of asthetics, but also because of functionality and apparent project health. Configured logger objects can be passed as suggested on pinojs/pino#1108 (comment).

See also

Activity

  1. 0x2b3bfa0 commented on Sep 10, 2021

    @0x2b3bfa0
    MemberAuthor

    Try–it–yourself comparison

    const pino = require('pino');
    const winston = require('winston');
    
    const pinoLogger = pino(
      {
        prettyPrint: {
          ignore: 'pid,hostname',
          translateTime: true,
          colorize: true
        },
        level: 'debug'
      },
      process.stderr
    );
    
    const winstonLogger = winston.createLogger({
      level: 'debug',
      format: winston.format.combine(
        winston.format.colorize(),
        winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss.SSS ZZ' }),
        winston.format.simple()
      ),
      transports: [
        new winston.transports.Console({
          stderrLevels: Object.keys(winston.config.npm.levels)
        })
      ]
    });
    
    for (logger of [pinoLogger, winstonLogger]) {
      logger.error(new Error('runners are exhausted because of cloud altitude'));
      logger.warn('the personal access token has been written backwards');
      logger.info('no bot dared to comment on your last commit');
      logger.debug('this repository contains files');
    }

    Pino

    Captura de pantalla 2021-09-10 a las 3 45 41 copia

    Winston

    Sin título-1 copia

  2. added
    enhancement
    ui/ux
    discussion
    on Sep 10, 2021
  3. DavidGOrtega commented on Sep 17, 2021

    @DavidGOrtega
    Contributor

    I do not understand what do you want to showcase with this example. Whats the main difference?

  4. 0x2b3bfa0 commented on Sep 23, 2021

    @0x2b3bfa0
    MemberAuthor
    1. Full and readable stack traces for errors
    2. Object formatting
  5. dacbd commented on Oct 31, 2022

    @dacbd
    Contributor

    p3-cool-if-someone-is-really-bored-on-a-weekend or p4-graveyard?

  6. 0x2b3bfa0 commented on Oct 31, 2022

    @0x2b3bfa0
    MemberAuthor

    p5-low-priority-enough-to-postpone-choosing-a-priority

  7. added
    technical-debt
    on Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionenhancementtechnical-debtui/ux

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions