Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loggly

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loggly - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

26

lib/loggly/client.js

@@ -61,2 +61,3 @@ /*

log: [url, 'inputs', this.token].join('/'),
bulk: [url, 'bulk', this.token].join('/'),
api: 'https://' + [this.subdomain, 'loggly', 'com'].join('.') + '/' + api

@@ -87,14 +88,23 @@ };

if (msg instanceof Object) {
msg = this.json ? JSON.stringify(msg) : common.serialize(msg);
}
else {
msg = this.json ? JSON.stringify({ message : msg }) : msg;
}
var self = this,
logOptions;
//
// Remark: Have some extra logic for detecting if we want to make a bulk
// request to loggly
//
var isBulk = Array.isArray(msg);
function serialize (msg) {
if (msg instanceof Object) {
return self.json ? JSON.stringify(msg) : common.serialize(msg);
}
else {
return self.json ? JSON.stringify({ message : msg }) : msg;
}
};
msg = isBulk ? msg.map(serialize).join('\n') : serialize(msg);
logOptions = {
uri: this.urls.log,
uri: isBulk ? this.urls.bulk : this.urls.log,
method: 'POST',

@@ -101,0 +111,0 @@ body: msg,

{
"name": "loggly",
"description": "A client implementation for Loggly cloud Logging-as-a-Service API",
"version": "1.0.2",
"version": "1.0.3",
"author": "Nodejitsu Inc. <info@nodejitsu.com>",

@@ -6,0 +6,0 @@ "maintainers": [

@@ -94,2 +94,9 @@ # node-loggly

### Logging arrays
It is possible to send arrays, which will result in one single request to Loggly.
``` js
input.log([ {iam:'number 1'}, {iam:'number 2'} ])
```
### Searching

@@ -96,0 +103,0 @@ [Searching][search-api] with node-loggly is easy. All you have to do is use the search() method defined on each Loggly client:

@@ -142,2 +142,23 @@ /*

}
}).addBatch({
"When using the node-loggly client without authentication": {
"the log() method": {
"takes an array": {
"when not passed a callback": {
topic: function () {
logglyJSON.log([
{ work: 'it harder' },
{ make: 'it better' }
]);
logglyJSON.on('log', this.callback.bind(null, null));
},
"should log messages to loggly": function (err, result) {
assert.isNull(err);
assert.isObject(result);
assert.equal(result.response, 'ok');
}
}
}
}
}
}).export(module);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc