Browse files

Documentation for balderdashy/sails#1411. Added timestamp config to l…

  • Loading branch information...
1 parent 3a31eef commit 6a3c329003aaf0731762bab0d800faceb5faef8c @russellsantos russellsantos committed Feb 17, 2014
Showing with 14 additions and 0 deletions.
  1. +14 −0
@@ -52,5 +52,19 @@ log: {
Once you restart the server, Sails will log messages to both the console and to the file. In the example `'Sails ist wunderbar')` the string `Sails ist wunderbar` would be logged to the console and to the file `application.log`.
+####Example: Adding timestamp to the logs
+If you want to add the timestamp to the log output, just edit the log object:
+log: {
+ level:'info',
+ timestamp:true
+Now,the example `'My log message')` will now have a timestamp, like so:
+2014-02-17T17:45:15.875Z - info: My log message
**Note**: Take note of the different log levels and how they are working together. In `config/log.js` we set our `level` to `info`. Meaning logs level `info` or below, will be logged to the console and to the file `application.log`. The only method above level `info`, is `verbose`. So in this example, log method `sails.log.verbose('...')` would not log to the console or file, because its log level is higher than the `level` we set in `config/log.js`.

0 comments on commit 6a3c329

Please sign in to comment.