New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bunyan-loggly

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-loggly - npm Package Compare versions

Comparing version 0.0.1 to 0.0.3

.npmignore

12

package.json
{
"name": "bunyan-loggly",
"version": "0.0.1",
"version": "0.0.3",
"description": "A bunyan stream to transport logs to loggly",

@@ -20,3 +20,11 @@ "main": "index.js",

},
"homepage": "https://github.com/smebberson/bunyan-loggly"
"homepage": "https://github.com/smebberson/bunyan-loggly",
"dependencies": {
"loggly": "~1.0.3"
},
"devDependencies": {
"mocha": "~1.18.0",
"should": "~3.1.3",
"bunyan": "~0.22.1"
}
}
bunyan-loggly
=============
A bunyan stream to send logs through to loggly
A bunyan stream to send logs through to loggly.
bunyan-loggly is under early development. So far, it's simply but it works. I will be adding the following:
- support for error reporting when node-loggly fails to transfer to loggly
- basic buffering support
bunyan-loggly uses node-loggly under the hood. As such, when configuring bunyan-loggly as a stream for bunyan, you need to pass in the standard and required node-loggly configuration object.
For example:
```javascript
{
token: "your-really-long-input-token",
subdomain: "your-subdomain",
auth: {
username: "your-username",
password: "your-password"
}
}
```
## Usage
This is a basic usage example.
```javascript
var bunyan = require('bunyan'),
Bunyan2Loggly = require('bunyan-loggly').Bunyan2Loggly,
logger;
// create the logger
logger = bunyan.createLogger({
name: 'logglylog',
streams: [
{
type: 'raw',
stream: new Bunyan2Loggly({
token: 'your-account-token',
subdomain: 'your-sub-domain',
auth: {
username: 'your-username',
password: 'your-password'
}
})
}
]
});
logger.info({});
```
This is an example of using bunyan-loggly to store express.js request logs.
```javascript
var path = require('path'),
bunyan = require('bunyan'),
serializerRequest = require('../lib/serializer-request'),
Bunyan2Loggly = require('bunyan-loggly').Bunyan2Loggly,
request;
// create the logger
request = bunyan.createLogger({
name: 'request',
serializers: { req: bunyan.stdSerializers.req },
streams: [
{
type: 'raw',
stream: new Bunyan2Loggly({
token: 'your-account-token',
subdomain: 'your-sub-domain',
auth: {
username: 'your-username',
password: 'your-password'
}
})
}
]
});
// export the middleware
module.exports = function () {
return function (req, res, next) {
// move on straight away
next();
// log this request
request.info({
req : req,
production: process.env.NODE_ENV === 'production'
});
}
}
```
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