Node.js console.log vs console.info

后端 未结 10 1160
青春惊慌失措
青春惊慌失措 2021-01-30 15:51

What is the benefit of using console.log vs console.info? Or any of the other console commands for that matter?

console.info(\"info\")         


        
10条回答
  •  隐瞒了意图╮
    2021-01-30 16:01

    It has been established that log and info are basically the same thing, but I'm not sure that completely answers the question:

    What is the benefit of using console.log vs console.info?

    One benefit, apart from what has already been mentioned, is you can use each for a different purpose. For example, you might use console.log just for quick debugging and spitting things out to the console, while you might use console.info for permanent messages you want to output to the console in your code, such as information on the current app status. Then when you have a situation where a random object is printed in your console and you realize you've left a log statement in there somewhere by accident, you can do a global search for 'console.log' and delete every instance and have confidence you didn't delete anything important that you meant to leave in there.

提交回复
热议问题