SuperKrish SuperKrish - 1 month ago 7
Javascript Question

Difference between console.log and logger.log in Node JS

I am currently working with nodejs application. We use

console.log
for server side printing purpose, But here
logger.log
also used. Both will do the same work, but
logger.log
isn't able to be used more than once in a function like below

logger.log('check level 1')
logger.log('check level 2')


anybody can help?

Answer

Finally I got Answer,

Console.log

  • only shows the output in console, doesnot store on anywhere. It only used on runtime

logger.log

  • store the output and error in a file, as well as print in console.We can control the size of logfile as wellas

if i missed anything, please point out my mistakes