Node.js console.log vs console.info

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

    According to the docs it's pretty clear.

    console.info([data], [...])# Same as console.log.

    console.error([data], [...])# Same as console.log but prints to stderr.

    console.warn([data], [...])# Same as console.error.

    This means there is no benefit or downside. info == log, and warn == error. Unless you want to print to stderr, info and or log will work.

提交回复
热议问题