Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sails.js logging system

I need to implement logging to our sails server. I have found sails logging to file

But I am afraid I don't understand it very well. Intention is to replace console.log with log system.

This is just one example of many places where I need to implement logger:

  s3.putObject(params, function (err, data) {
                        if (err)
                            console.log(err);
                        else                         
                            console.log("Successfully uploaded " + 

//etc

like image 496
Wexoni Avatar asked Mar 20 '23 03:03

Wexoni


1 Answers

You can use sails.log.error(), sails.log.warn(), sails.log.verbose(), etc to send logs to the console, or even to a file if you configure so in the config/logs.js file. There you can also specify the level of log to get in the output, or you can do it passing parameters in the sails command line (--verbose).

like image 148
Diego Pamio Avatar answered Apr 07 '23 04:04

Diego Pamio