Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Log in SailsJS

What is the actual syntax to log in SailsJS?

Docs don't have anything, but found the following line in the site's roadmap

"Pull out Sails.log (winston wrapper) as a separate module so it can be used by waterline"

I image it's something like:

Sails.log(...)
Sails.error(...)
Sails.warn(...)
like image 775
binarygiant Avatar asked Mar 23 '14 14:03

binarygiant


1 Answers

In your controllers, models, services, and anywhere else that the sails global is available, you can log with one of:

sails.log();
sails.log.warn();
sails.log.info();
sails.log.debug();
sails.log.error();
sails.log.verbose();
sails.log.silly();

The logging level (that is, the level at which logs will be output to the console) is set in /config/log.js.

like image 115
sgress454 Avatar answered Oct 19 '22 05:10

sgress454