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

hapi-ot-logger

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-ot-logger - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

2

lib/logger.js

@@ -42,2 +42,3 @@ var os = require("os"),

console: false,
payload: false,
sequencenumber: 1,

@@ -67,2 +68,3 @@ host: os.hostname()

query: request.query,
payload: cfg.payload ? stringifySafe(request.payload) : null,
status: request.response.statusCode,

@@ -69,0 +71,0 @@ duration: (Date.now() - request.info.received) * 1000, // just to be compliant. sigh

2

package.json
{
"name": "hapi-ot-logger",
"version": "2.0.0",
"version": "2.1.0",
"description": "logger conforming to ot standards",

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

@@ -34,3 +34,4 @@ #Hapi-ot-logger

},
console: true // optional console output for debugging, defaults to false
console: true // optional console output for debugging, default: false
payload: false // include the request payload (request.payload stringified), default: false
}

@@ -48,5 +49,1 @@ }], function(err){

```
Future plans:
- Add kafka support

@@ -15,3 +15,3 @@ var joi = require('joi');

events: joi.array().required(),
method: joi.string().valid('get').required(),
method: joi.string().valid(['get', 'post', 'put']).required(),
url: joi.string().valid('/foo').required(),

@@ -21,2 +21,3 @@ query: joi.object({

}).required(),
payload: joi.string(),

@@ -23,0 +24,0 @@ "ot-requestid": joi.string().valid("abcd-1234-abcd-1234").required(),

@@ -47,3 +47,4 @@ describe('logger tests', function(){

port: remoteServer.address().port
}
},
payload: true
};

@@ -96,2 +97,39 @@ done();

it('should include the body from a PUT/POST request', function(done){
events[0].handler({
method: 'post',
path: '/foo',
query: {
flarg: 'glarg'
},
payload: {
foo: 'bar',
baz: { flarg: 'glarg' }
},
response: {
statusCode: 200
},
info: {
received: Date.now()
},
getLog: function(){ return []; },
headers: {
"ot-requestid": "abcd-1234-abcd-1234",
"user-agent": "tests",
"ot-userid": "user1234",
"ot-sessionid": "1234-abcd-1234-abcd",
"ot-referringhost": "referringhost",
"ot-referringservice": "referringservice",
"accept-language": "en-GB,en;q=0.8"
}
});
setTimeout(function(){
joi.validate(logs[1], schema.request, function(err){
logs[1].payload.should.equal('{"foo":"bar","baz":{"flarg":"glarg"}}');
done(err);
});
}, 10);
});
it('should handle a log', function(done){

@@ -106,3 +144,3 @@ events[1].handler({

setTimeout(function(){
joi.validate(logs[1], schema.log, function(err){
joi.validate(logs[2], schema.log, function(err){
done(err);

@@ -119,3 +157,3 @@ });

setTimeout(function(){
joi.validate(logs[2], schema.error, function(err){
joi.validate(logs[3], schema.error, function(err){
done(err);

@@ -122,0 +160,0 @@ });

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