nest-winston
nest-winston copied to clipboard
Formatter fails on BigInt
Hi,
When trying to log an error object, the logger failed for me with the error:
[unable to serialize, circular reference is too complex to analyze]
After debugging I found out that the problem was caused because the error object contained a BigInt
and JSON.stringify()
throws a TypeError
if it encounters a BigInt
. This was actually solved in winston/logform
version 2.2.0 (https://github.com/winstonjs/logform/pull/84) by converting all BigInt
's into strings, but nest-winston
relies on fast-safe-stringify
directly, so it doesn't have the benefit of this is fix.
https://github.com/gremo/nest-winston/blob/e82e927d004e81407983ff345441d489d4af0519/src/winston.utilities.ts#L37
Can nest-winston
apply a similar fix for BigInt
's, or possibly there is a way to let logform handle the stringification instead of calling fast-safe-stringify
directly? I see for example logform also catches objects of type Buffer
. Relying on logform might be more future proof, they can then take care of these edge cases.
Thank you for the easy integration of winston into Nest!
Well, it seems quite easy. I'll push to master in the next few days I hope. Mind if I ask you to test it before releasing a new version?
Sure, if you can provide some instructions on how I can test a branch/dev version I can easily run a quick test. I have some Node experience but never made any of my own libraries or used branch/dev versions so not sure how you can install them :)
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.