produces invalid JSON
borisovg opened this issue · 5 comments
Logger will produce invalid JSON if the object includes keys with undefined
value.
Code:
var bole = require('bole');
var log = bole('TEST');
bole.output({
level: 'info',
stream: process.stdout
});
log.info({ foo: undefined }, 'Test Message');
Errror (output line will include "foo":undefined
)
$ node index.js | jq .
parse error: Invalid numeric literal at line 1, column 137
Not sure if you have looked into this however if you debug it the line here.
https://github.com/rvagg/bole/blob/master/bole.js#L58
You can view the undefined
value and that is obviously not valid json in this case. Not sure what the maintainers would want here could try a JSON parse of the value and if it fails could come up with something to inform the user, regex would also work.
If the maintainers think this is something worth fixing i can submit a pr with some tests if it seems like something that should be included.
haha, nice! glad I could be inspiration for a new work .. even if it was through dysfunction