I have a Sails.js project that I want to add LogEntries support for event logging. However, I would like to use LogEntries only in some environments
For example, in development I do not want to fill the log with development garbage.
// config / log.js var loginarios = Required ('le_node'); Var log = (sails.config.environment === 'development')? Sails.log: logentries.logger ({token: 'YOUR_TOKEN'}); Module.exports.log = {log: {custom: log}}
But with this I get an error that sails
is not defined because the That is not available in sails
object configuration files like config / log.js
. In this case how can custom log transportation be used on the basis of environment?
What appears to be the correct config / log.js
file Was not modified but to modify the environment configuration file:
// config / env / production.js var logentries = ('le_node'); Var log = logentries.logger ({token: 'YOUR_TOKEN'}); Modules.export.log = {log: {custom: log}}
This way only custom logging will occur in the production environment.
No comments:
Post a Comment