muzzley / good-bunyan Goto Github PK
View Code? Open in Web Editor NEWA good reporter implementation to write hapi server events to a bunyan logger.
Home Page: https://www.npmjs.com/package/good-bunyan
License: MIT License
A good reporter implementation to write hapi server events to a bunyan logger.
Home Page: https://www.npmjs.com/package/good-bunyan
License: MIT License
I am using good, good-bunyan, and hapi-swagger.
Logging works fine, until I hit the swagger documentation. The documentation endpoint returns swagger.json
I get the following error while making the /documentation
which fetches the swagger.json (this is quite large). I have set responsePayload: true, with this set to false, everything works fine.
Debug: internal, implementation, error
TypeError: Converting circular structure to JSON
at Object.stringify (native)
at Object.defaultFormatters.response (/Users/zzakaria/code/orc/orcfacade/node_modules/good-bunyan/lib/index.js:21:38)
at DestroyableTransform.goodBunyanTransform [as _transform] (/Users/zzakaria/code/orc/orcfacade/node_modules/good-bunyan/lib/index.js:123:58)
at DestroyableTransform.Transform._read (/Users/zzakaria/code/orc/orcfacade/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
at DestroyableTransform.Transform._write (/Users/zzakaria/code/orc/orcfacade/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
at doWrite (/Users/zzakaria/code/orc/orcfacade/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:313:64)
at writeOrBuffer (/Users/zzakaria/code/orc/orcfacade/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:302:5)
at DestroyableTransform.Writable.write (/Users/zzakaria/code/orc/orcfacade/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:241:11)
at ondata (_stream_readable.js:529:20)
at emitOne (events.js:90:13)
at emit (events.js:182:7)
at readableAddChunk (_stream_readable.js:147:16)
at Readable.push (_stream_readable.js:111:10)
at Transform.push (_stream_transform.js:128:32)
at internals.Squeeze._transform (/Users/zzakaria/code/orc/orcfacade/node_modules/good-squeeze/lib/squeeze.js:31:14)
at Transform._read (_stream_transform.js:167:10)
at Transform._write (_stream_transform.js:155:12)
at doWrite (_stream_writable.js:292:12)
at writeOrBuffer (_stream_writable.js:278:5)
at Writable.write (_stream_writable.js:207:11)
at Readable.ondata (_stream_readable.js:529:20)
at emitOne (events.js:90:13)
at Readable.emit (events.js:182:7)
at readableAddChunk (_stream_readable.js:147:16)
at Readable.push (_stream_readable.js:111:10)
at internals.Monitor._responseHandler (/Users/zzakaria/code/orc/orcfacade/node_modules/good/lib/monitor.js:244:22)
at emitOne (events.js:90:13)
at emit (events.js:182:7)
I recently came a cross an issue with good-winston
being wrongly implemented as a transform stream instead of a writable stream (lancespeelmon/good-winston#6).
It seems like good-bunyan
is doing the same which might cause it to stop logging after ~31 events.
You can check the discussion on good -
hapijs/good#518
I think you forgot ๐
Hi,
When using the server.log function with multiple tags it is not documented in the log entry in the file.
For example - For the following server.log command
server.log(['log','server','start','demo','info','tag1','tag2','tag3'], {message: Server started at ${ server.info.uri }
, uri: server.info.uri});
The good-console will write to the console:
180909/213134.152, [log,log,server,start,demo,info,tag1,tag2,tag3] data: {"message":"Server started at http://computer:50268","uri":"http://computer:50268"}
And the good-bunyan will write to the file (Using the bunyan logger):
{"name":"demo-logger","hostname":"computer","pid":9396,"level":30,"message":"Server started at http://computer:50268","uri":"http://computer:50268","msg":"[log]","time":"2018-09-09T21:31:34.157Z","v":0}
My question is why the tags are not also written to the log in the file?
Attached the code I used in my question (example.zip).
Thanks,
Shay
example.zip
383d114 bumps version to v0.2.0, but NPM still has v0.1.2 as the latest.
Please run npm publish
to publish the latest release to NPM.
Also, run git push --tags
to push your release tags to GitHub.
Hey,
Long time bunyan
user since restify
. Hopped on hapi
bandwagon just recently and trying to implement good-bunyan
.
However, am I right to assume it is not currently compatible with the good
's recent 7.0.0 release?
I get an error when I try to pipe good-bunyan into white-out. Here's my configuration:
export const good = {
register: require('good'),
options: {
reporters: {
bunyan: [{
module: 'good-bunyan',
args: [
{ ops: '*', request: '*', log: '*', response: '*', error: '*'},
{ logger: log }
]
}, {
module: 'white-out',
args: [{
password: 'censor'
}]
}]
}
}
};
I'm using good-bunyan in conjunction with white-out a censoring plugin referenced in the Hapi documentation. Whenever good attempts to pipe the output of good-bunyan into white-out, it seems to fail. However, good-bunyan by itself works fine.
Here's the error message I get from the server:
There was a problem (Error: Cannot pipe, not readable) in bunyan and it has been destroyed.
Error: Cannot pipe, not readable
at GoodBunyan.Writable.pipe (_stream_writable.js:186:22)
at pipe (/project/node_modules/pump/index.js:54:15)
at Array.reduce (native)
at pump (/project/node_modules/pump/index.js:77:18)
at Pumpify.setPipeline (/project/node_modules/pumpify/index.js:39:5)
at new Pumpify (/project/node_modules/pumpify/index.js:15:30)
at Function.Pumpify [as obj] (/project/node_modules/pumpify/index.js:13:44)
at internals.forOwn (/project/node_modules/good/lib/monitor.js:147:53)
at Object.internals.forOwn (/project/node_modules/good/lib/monitor.js:230:9)
at Monitor.start (/project/node_modules/good/lib/monitor.js:105:19)
Node version: v7.10.0
bunyan: 1.8.10
good: 7.2.0
good-bunyan: 1.3.0
hapi: 16.4.3,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.