Open techieshark opened 4 years ago
Oh, now you found a bug. Now I have to convert this whole project to typescript because I'm not "fluent" in coffee-script anymore. :P
Ah, haha sorry @jwalton! ;)
Yeah it seems like a strange one, because as seen in the second screenshot (in issue description, above), this library is actually passing in maxLines: 'auto'
to the exceptionFormatter (that console.log
was one I added directly to the compiled JS in node_modules/
).
I haven't switched over to the watson version yet, so if this were fixed that'd be super. But it's not a blocker because the workaround is just to use exceptionFormatter
directly:
const bunyanLogger = bunyan.createLogger({ ... });
bunyanLogger.addStream({
stream: bunyanDebugStream({
basepath: projectRoot, // this should be the root folder of your project.
maxExceptionLines: 'auto', // pass through to exception formatter as 'maxLines: auto'
}),
});
bunyanLogger.addSerializers({
// bunyan-debug-stream seems to somehow clobber the maxExceptionLines:auto
// setting, so to auto-truncate we use exception-formatter directly here:
err: (e) => exceptionFormatter(e, {
basepath: projectRoot,
colors: true, // highlight our code in stack trace
format: 'ansi', // color
maxLines: 'auto', // auto: truncate code that isn't ours
}),
});
I like the effect provided by
exception-formatter
with optionauto
, where stack outside of your own code is truncated (automatically).I can get that effect if I use the formatter directly:
But if I use bunyan-debug-stream with
maxExceptionLines: 'auto'
,it does not truncate (though as shown by the color, it seems exception formatter successfully determines what is my code vs not my code):
See anything I'm missing?