An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
December 31, 2021 06:30 am GMT
Original Link: https://dev.to/imshivanshpatel/good-bye-consolelogno-consolelog-in-2022-1foc
Good Bye console.log,no console.log in 2022
yes you heard it right.
we frequently use console.log() to check our outputs in console, it's ok in Development mode but it is highly disgraced in production.
so then what's the solution for it.so in production we basically use production grade loggers.This article is going to teach you how to use ps-logger.
Q.Why ps-logger ?
=>yes you have few other options but the problem is that you have to do lots of manual configurations in it.That's why beginners don't even touch production grade loggers.
ps-logger is a plug and play logger.There is no manual configurations.you have to just install and use it.
npm i ps-logger
- Example:-
const logger=require('ps-logger');logger.info("This is info")logger.warn("This is warning");logger.error("This is error");logger.debug("This is debug");logger.prompt("This is prompt");logger.verbose("This is verbose");logger.silly("This is silly");
- if you want to disable its colors
logger.setColor(false);
in future updates it will provide more features to you guys
Original Link: https://dev.to/imshivanshpatel/good-bye-consolelogno-consolelog-in-2022-1foc
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To