Closed agoops closed 5 years ago
Good catch! I'd happily take a PR.
Realized a quick fix that one can set the type of stream to stream
instead of raw
. That way, bunyan will serialize if before passing it to bunyan-debug-stream.
So an updated config would look like
var bunyanDebugStream = require('bunyan-debug-stream');
var bunyan = require('bunyan');
var log = bunyan.createLogger({
name: "myLog",
streams: [{
level: 'info',
type: 'stream',
stream: bunyanDebugStream({
forceColor: true
})
}],
});
Hi, I noticed that when trying to log an object with a circular reference, bunyan-debug-stream throws an error:
TypeError: Converting circular structure to JSON
.It seems that's the case because it calls
JSON.stringify
here.Is there a way to override that with something like
util.inspect
so that circular references are handled when converted to strings?An example case showing the circular reference:
throws
Thanks!