node-logentries
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -23,8 +23,4 @@ /* Copyright (c) 2011 Richard Rodger */ | ||
var logline = | ||
'"'+entry[0].toISOString()+'" ' + // timestamp | ||
'"'+entry[1]+'" ' + // level | ||
'"'+entry[2]+'"' + // event data | ||
'\n' | ||
var logline = opts.token + '"' + entry.join('" "') + '"\n'; | ||
try { | ||
@@ -57,5 +53,4 @@ queue.shift() | ||
host: 'api.logentries.com', | ||
port: 80, | ||
path: '/'+opts.userkey+'/hosts/'+opts.host+'/'+opts.log+'/?realtime=1', | ||
method: 'PUT' | ||
port: 10000, | ||
token: opts.token | ||
} | ||
@@ -132,5 +127,3 @@ | ||
* opts: | ||
* userkey: required; logentries user key | ||
* host: required: logentries host | ||
* log: required; logentries log name | ||
* token: required; Logentries Destination Token UUID | ||
* | ||
@@ -192,3 +185,5 @@ * transport: LogEntriesTransport; transport object | ||
var levelval = self.levels[arglevel] | ||
var timestamp = | ||
opts.timestamp === undefined || opts.timestamp === true ? true : false; | ||
if( undefined == levelval ) { | ||
@@ -199,15 +194,21 @@ self.emit('error','unknown log level: '+arglevel) | ||
if( loglevel <= levelval ) { | ||
args.unshift(new Date()) | ||
var data = args[2] | ||
var data = args[1] | ||
if( data && data.toISOString && data.getTimezoneOffset ) { | ||
args[2] = data.toISOString() | ||
args[1] = data.toISOString(); | ||
} | ||
else if( 'object' == typeof( data ) || Array.isArray(data) ) { | ||
args[2] = JSON.stringify(data) | ||
args[1] = JSON.stringify(data); | ||
} | ||
else { | ||
args[2] = ''+data | ||
args[1] = ''+data; | ||
} | ||
if (timestamp) { | ||
t = new Date().toISOString(); | ||
args.unshift(t); | ||
} | ||
//console.log('args: ', args); | ||
queue.push(args) | ||
@@ -263,3 +264,5 @@ transport.consume() | ||
} | ||
util.inherits(LogentriesLogger, winston.Transport) | ||
LogentriesLogger.prototype.log = function (level, msg, meta, callback) { | ||
@@ -266,0 +269,0 @@ var data = msg + (meta?' '+JSON.stringify(meta):'') |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["log", "logging", "winston", "logentries", "logentries.com", "wrapper","api"], | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/rjrodger/node-logentries", | ||
@@ -19,2 +19,7 @@ "author": "Richard Rodger <richard@chartaca.com> (http://richardrodger.com/)", | ||
"repository": { "type" : "git", "url" : "https://github.com/rjrodger/node-logentries.git" }, | ||
"files":[ | ||
"package.json", | ||
"README.md", | ||
"lib/logentries.js" | ||
], | ||
"engines": { | ||
@@ -21,0 +26,0 @@ "node": "*" |
@@ -21,5 +21,3 @@ # node-logentries | ||
var log = logentries.logger({ | ||
userkey:'YOUR_USER_KEY', | ||
host:'YOUR_HOST', | ||
log:'YOUR_LOG_NAME' | ||
token:'YOUR_TOKEN' | ||
}) | ||
@@ -78,7 +76,5 @@ | ||
Once you have logentries.com account, you will need three configuration items to initialize a logging instance (you can create more than one): | ||
Once you have logentries.com account, you need just one configuration item to initialize a logging instance (you can create more than one): | ||
* USER_KEY: as supplied by logentries.com | ||
* HOST_KEY: as supplied by logentries.com | ||
* LOG_NAME: either the name of an existing log on logentries.com, or an entirely new name (which will be dynamically created). | ||
* TOKEN: As supplied by Logentries when you create a logfile of source type Token TCP. | ||
@@ -132,5 +128,3 @@ The module provides you with a set of logging methods that correspond to the standard syslog log levels. These are, in order of increasing severity: | ||
var log = logentries.logger({ | ||
userkey:'YOUR_USER_KEY', | ||
host:'YOUR_HOST', | ||
log:'YOUR_LOG_NAME' | ||
token:'YOUR_TOKEN' | ||
}) | ||
@@ -147,10 +141,9 @@ | ||
* _userkey_: required; logentries user key | ||
* _host_: required; logentries host | ||
* _log_: required; logentries log name | ||
* _token_: required; logentries destination token uuid | ||
* _transport_: optional; default is LogEntriesTransport; transport object | ||
* _levels_: optional; default is syslog-style; custom log levels | ||
* _printerror_: optional; default is true; print errors to STDERR with console.error | ||
* _timestamp_: optional; default is true; autogenerate a timestamp | ||
The _userkey_, _host_ and _log_ entries relate to your logentries.com configuration. The _transport_ option allows you to | ||
The _token_ entry relates to your logentries.com configuration. The _transport_ option allows you to | ||
provide an alternative transport implementation (see below). | ||
@@ -177,3 +170,3 @@ | ||
The log level and a timestamp are prefixed (in that order) to the log entry, and will be present in the logentries.com console. | ||
The log level and an optional timestamp are prefixed (in that order) to the log entry, and will be present in the logentries.com console. | ||
@@ -180,0 +173,0 @@ The <loglevel> convenience methods are dynamically constructed from the configured list of logging levels, a method being constructed for each level, |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
0
17311
307
2