Good Bye console.log,no console.log in 2022
SHIVANSH PATEL
Posted on December 31, 2021
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
Posted on December 31, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.