DEV Community

SHIVANSH PATEL
SHIVANSH PATEL

Posted on

19 3

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
Enter fullscreen mode Exit fullscreen mode
  • 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");
Enter fullscreen mode Exit fullscreen mode

ps-logger

  • if you want to disable its colors
logger.setColor(false);
Enter fullscreen mode Exit fullscreen mode

in future updates it will provide more features to you guys

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

Top comments (23)

Collapse
 
grahamthedev profile image
GrahamTheDev
Comment hidden by post author
Collapse
 
imshivanshpatel profile image
SHIVANSH PATEL
Comment hidden by post author
Collapse
 
deathshadow60 profile image
deathshadow60 • Edited
Comment hidden by post author
Collapse
 
ezpzdevelopement profile image
Ez Pz Developement

it is the same man, i also don't want use an external library console is better for me

Collapse
 
imshivanshpatel profile image
SHIVANSH PATEL

Now its changed,see the latest update

Collapse
 
ezpzdevelopement profile image
Ez Pz Developement

i want the advantages , why are you hiding my comment ???

Thread Thread
 
imshivanshpatel profile image
SHIVANSH PATEL

You will get the advantages just wait for few days 👍

Thread Thread
 
ezpzdevelopement profile image
Ez Pz Developement • Edited

thank you , i want the advantages, why it is different from other libs , so maybe i can help to improve it with some prs

Thread Thread
 
imshivanshpatel profile image
SHIVANSH PATEL

offcourse bro

Collapse
 
ezpzdevelopement profile image
Ez Pz Developement
Comment hidden by post author
Collapse
 
minecodes profile image
Minecodes

This is a good idea 😉
I've programmed it myself so far, but I think you have a better solution than me.

Collapse
 
imshivanshpatel profile image
SHIVANSH PATEL

Thanks bro, I just launched it 2 days ago 😀

Collapse
 
minecodes profile image
Minecodes

I made a pull request 😉

Thread Thread
 
imshivanshpatel profile image
SHIVANSH PATEL

Thanks for your contribution , let me check i will surely approve your PR

Thread Thread
 
imshivanshpatel profile image
SHIVANSH PATEL

PR approved 🎉

Collapse
 
seven_77 profile image
Seven

implement on your own is always the good way to learn something, after checking your repo I found one issue which we got the same date even using a timer, PR raised.

Collapse
 
imshivanshpatel profile image
SHIVANSH PATEL

Ok bro let me check 👍

Collapse
 
imshivanshpatel profile image
SHIVANSH PATEL

PR APPROVED

Collapse
 
earthboundmisfit profile image
Muzammil

Great contribution!!

Collapse
 
imshivanshpatel profile image
SHIVANSH PATEL

Thanks

Collapse
 
vivekkodira profile image
Vivek Kodira

Nice work Shivansh.

Collapse
 
imshivanshpatel profile image
SHIVANSH PATEL

Thank you ❤️

Collapse
 
lazypro profile image
ChunTing Wu • Edited

If I really need a logger on production, then I would rather log to the file or a log server instead of the console.
I don't know what's the benefit of using a 3rd party console logger.

Some comments have been hidden by the post's author - find out more

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay