Node.js console.log vs console.info

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

    While console.log and console.info might not be different, there are other uses except mere coloring. For example, when using a linter like eslint, you can set console.log to provide a warning message. Let's say you only want to use console.log for your development purposes and use console.info for information that end users might need. With a linter you now have a visible and direct reminder of your temporary console.log that aid you during development, but must be removed before commits/publishing.

提交回复
热议问题