How to set log level in node.js?

nodejs

#1

I am trying out the default server.js script and when I run it, the console is full of debug messages. Can I set somehow the logging level so I see only errors for instance?

Example of the messages that I see and that I would like to get rid of:

debug - setting poll timeout
debug - client authorized for
debug - clearing poll timeout
debug - xhr-polling writing 1::
debug - set close timeout for client Dmtq05YdizVtNZFy1S4p

Thank you!


#2

that depends on your application, there is no universal method for that


#3

Hello.

you can use “morgan” for easy logging.