Node.js console.log vs console.info

后端 未结 10 1382
青春惊慌失措
青春惊慌失措 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:03

    I have seen where console.log is for temporarily logging of state information for debugging.

    console.info is a more permanent thing - such as saying what port something is running on, and something you wouldn't cut out after you are done debugging.

    This makes it easy to clean up your code for committing it. You can even have your linter have a rule to prevent console.log from being committed.

提交回复
热议问题