Logging with Winston for Praece sails apps.
- Automatically includes email, file and console logs
- File and email logs automatically default to JSON format
- Console logs default to formatted message with JSON meta data
- File and email logs are only enabled on production
- File logs are stored in
/app/log/dokku_[app name].log
- Linking persistent storage mapped to
/var/log/
is required for dokku
- File logs are stored in
#####The following env vars are required
APP_NAME
ENVIRONMENT
NODE_ENV
// Email log config.
module.exports.log = {
email: {
to: '[email protected]',
from: '[email protected]',
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'password!'
}
}
}
Movie.find()
.then(function(movies) {
sails.log.info('Found some movies', {movies: movies})
})
.catch(function(error) {
sails.log.error(error.message, {error: error, model: 'movie'})
});