Socket
Socket
Sign inDemoInstall

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.3 to 1.0.4

27

lib/loggly/client.js

@@ -41,8 +41,9 @@ /*

this.subdomain = options.subdomain;
this.token = options.token;
this.host = options.host || 'logs-01.loggly.com';
this.json = options.json || null;
this.auth = options.auth || null;
this.userAgent = 'node-loggly ' + loggly.version
this.subdomain = options.subdomain;
this.token = options.token;
this.host = options.host || 'logs-01.loggly.com';
this.json = options.json || null;
this.auth = options.auth || null;
this.userAgent = 'node-loggly ' + loggly.version;
this.useTagHeader = "useTagHeader" in options ? options.useTagHeader : true;

@@ -121,7 +122,7 @@ //

//
// Remark: if tags are passed in run the filter or just use default tags if
// they exist
// Remark: if tags are passed in run the filter on them and concat
// with any tags that were passed or just use default tags if they exist
//
tags = tags
? this.tagFilter(tags)
? (this.tags ? this.tags.concat(this.tagFilter(tags)) : this.tagFilter(tags))
: this.tags;

@@ -133,3 +134,9 @@

if (tags) {
logOptions.headers['x-loggly-tag'] = tags.join(',');
//decide whether to add tags as http headers or add them to the URI.
if (this.useTagHeader) {
logOptions.headers['x-loggly-tag'] = tags.join(',');
}
else {
logOptions.uri += "/tag/" + tags.join(",") + "/";
}
}

@@ -136,0 +143,0 @@

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

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

@@ -10,3 +10,3 @@ # node-loggly

### Getting Started
Before we can do anything with Loggly, we have to create a client with valid credentials. We will authenticate for you automatically:
Before we can do anything with Loggly, we have to create a client with valid credentials. We will authenticate for you automatically:

@@ -22,3 +22,7 @@ ``` js

password: "your-password"
}
},
//
// Optional: Tag to send with EVERY log message
//
tags: ['global-tag']
});

@@ -42,2 +46,15 @@ ```

### Logging with Tags
If you're using Loggly's [tags](https://www.loggly.com/docs/tags/) functionality, simply include an array of tags as the second argument to the `log` method:
``` js
client.log('127.0.0.1 - Theres no place like home', [ 'dorothy' ], function (err, result) {
// Do something once you've logged
});
```
*note* Tags passed into the log function will be merged with any global tags you may have defined.
### Logging Shallow JSON Objects as a String

@@ -52,7 +69,7 @@ In addition to logging pure strings it is also possible to pass shallow JSON object literals (i.e. no nested objects) to client.log(..) or input.log(..) methods, which will get converted into the [Loggly recommended string representation][sending-data]. So

};
input.log(source);
```
will be logged as:
will be logged as:

@@ -110,3 +127,3 @@ ```

var util = require('util');
client.search('404', function (err, results) {

@@ -118,7 +135,7 @@ // Inspect the result set

The search() method can also take an Object parameter that allows you to set additional search parameters such as: rows, from, until, etc.
The search() method can also take an Object parameter that allows you to set additional search parameters such as: rows, from, until, etc.
``` js
var util = require('util');
client.search({ query: '404', rows: 10 })

@@ -172,2 +189,2 @@ .run(function (err, results) {

[search]: http://www.loggly.com/docs/search-overview/
[vows]: http://vowsjs.org
[vows]: http://vowsjs.org
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