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

express-bunyan-logger

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-bunyan-logger - npm Package Compare versions

Comparing version 0.1.4 to 0.2.0

15

index.js

@@ -18,2 +18,3 @@ var bunyan = require('bunyan'),

parseUA = true,
excludes,
levelFn = defaultLevelFn;

@@ -38,2 +39,7 @@

if (opts.excludes) {
excludes = opts.excludes;
delete opts.excludes;
}
return function (err, req, res, next) {

@@ -43,3 +49,3 @@ var startTime = Date.now();

function logging(incoming) {
if(!incoming) {
if (!incoming) {
res.removeListener('finish', logging);

@@ -98,2 +104,9 @@ res.removeListener('close', logging);

err && (meta.err = err);
if (excludes) {
excludes.forEach(function(ex) {
delete meta[ex];
});
}
logFn.call(logger, meta, format(meta));

@@ -100,0 +113,0 @@ }

2

package.json
{
"name": "express-bunyan-logger",
"version": "0.1.4",
"version": "0.2.0",
"description": "a bunyan logger middleware for express",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -62,2 +62,6 @@ # Express-bunyan-logger

### options.excludes
Array of string, Those fields will be excluded from meta object which passed to bunyan
### options.immediate

@@ -64,0 +68,0 @@

@@ -73,5 +73,32 @@ var express = require('express');

it.only('test errorLogger', function(done) {
it('test excludes', function(done) {
var app = express();
var output = st();
app.use(bunyanLogger({
stream: output,
excludes: ['req', 'res', 'nont']
}));
app.get('/', function(req, res) {
res.send('GET /');
});
request(app)
.get('/')
.expect('GET /', function(err, res) {
var json = JSON.parse(output.content.toString());
assert.equal(json.name, 'express');
assert.equal(json.url, '/');
assert.equal(json['status-code'], 200);
assert(!json.res);
assert(!json.req);
done();
});
});
it('test errorLogger', function(done) {
var app = express();
var output = st();
app.use(app.router);

@@ -78,0 +105,0 @@ app.use(bunyanLogger.errorLogger({

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