-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using pino
instead of winston
for logging
#709
Labels
discussion
Waiting for team decision
enhancement
New feature or request
technical-debt
Refactoring, linting & tidying
ui/ux
User interface/experience
Comments
This was referenced Sep 9, 2021
Try–it–yourself comparisonconst 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');
} PinoWinston |
I do not understand what do you want to showcase with this example. Whats the main difference? |
|
|
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
discussion
Waiting for team decision
enhancement
New feature or request
technical-debt
Refactoring, linting & tidying
ui/ux
User interface/experience
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
The text was updated successfully, but these errors were encountered: