diff --git a/README.md b/README.md index f2573c4..cacf546 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,8 @@ var options = { hostname: myHostname, ip: ipAddress, mac: macAddress, - app: appName + app: appName, + env: envName }; // Defaults to false, when true ensures meta object will be searchable @@ -141,6 +142,16 @@ Max Length: `32` The default hostname passed along with every log sent through this instance. +##### env + +_**Optional**_ +Type: `String` +Default: `''` +Values: `YourCustomEnvironment` +Max Length: `32` + +The default environment passed along with every log sent through this instance. + ##### index_meta _**Optional**_ @@ -253,6 +264,16 @@ Max Length: `32` The app passed along with this log line. +##### env + +_**Optional**_ +Type: `String` +Default: `''` +Values: `YourCustomEnvironment` +Max Length: `32` + +The environment passed along with this log line. + ##### meta _**Optional**_ @@ -301,7 +322,8 @@ var options = { hostname: myHostname, ip: ipAddress, mac: macAddress, - app: appName + app: appName, + env: envName }; // Defaults to false, when true ensures meta object will be searchable diff --git a/lib/logger.js b/lib/logger.js index c362209..f8e795e 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -75,6 +75,7 @@ function Logger(key, options) { hostname: options.hostname || os.hostname() , app: options.app || 'default' , level: options.level || 'INFO' + , env: options.env || undefined }; this._req = request.defaults({ @@ -106,6 +107,7 @@ Logger.prototype.log = function(statement, opts) { , line: statement , level: this.source.level , app: this.source.app + , env: this.source.env }; if (opts) { if (_.isString(opts)) { @@ -121,6 +123,7 @@ Logger.prototype.log = function(statement, opts) { } message.level = opts.level || message.level; message.app = opts.app || message.app; + message.env = opts.env || message.env; if (opts.timestamp && isValidTimestamp(opts.timestamp)) { message.timestamp = opts.timestamp; }