Logger
Winston logger to use with the Logstash and Kibana.
Usage
npm install @sinet/logger --save
Example
var options = {
'file' : {
'enabled' : [ 'development', 'production' ],
'filename' : 'logs/myLogFile.log',
},
'console' : {
'enabled' : [ 'development' ],
'level' : 'debug'
},
'logstash' : {
'enabled' : [ 'production' ],
'port' : 9563
},
'additional' : {
'container' : 'user-service',
'hostname' : os.hostname(),
'dockerhost' : process.env.DOCKER_HOST || 'undefined'
}
};
var logger = require( '@sinet/logger' )( options );
logger.error( 'error message', { 'method': 'v1.users.get', 'payload', payload } );
FAQs
- What happens when I add a
file
or console
option without setting the enabled
property?
var options = {
'file' : {},
'console' : {}
}
Answer:
If file
and/or console
is explicitly provided without setting the enabled property it will log in any environment.
Contributing
All pull requests must follow coding conventions and standards.