Fixed prettyPrint to pass through non-json lines

This commit is contained in:
Alex Mikhalev 2018-08-25 12:22:10 -06:00
parent ed8d012a4b
commit 942fded9d6

View File

@ -122,7 +122,13 @@ function asColoredLevel(value: any) {
}
const prettyTransport = through.obj((chunk, enc, cb) => {
const value = JSON.parse(chunk.toString());
let value: any;
try {
value = JSON.parse(chunk.toString());
} catch (e) {
process.stdout.write(chunk.toString() + "\n");
return cb();
}
const line = formatter(value);
if (!line) {
return cb();