Skip to content

File, email and console logging for Praece sails apps

Notifications You must be signed in to change notification settings

praece/sails-logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Praece Sails Logs

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

Configuration:

#####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!'
    }
  }
}

Usage:

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'})
	});

About

File, email and console logging for Praece sails apps

Resources

Stars

Watchers

Forks

Packages

No packages published