You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to log an error object, that has some extra context. The error serializer ignores anything but type, message and stack. Would you consider extending the error serializer to make it hydrate the resulting _err object with the extra fields it may have? Or should I rather use the pino-std-serializers directly, serialize my error object directly, then hydrate it and then pass it to pino?
Example:
constlogger=pino();consterr=newError('Boom!');err.foo='bar';// Expecting to see `foo: bar` logged here, but it's notlogger.error(err);
Here's the interim solution I have:
conststdSerializers=require('pino-std-serializers');constlogger=pino();// Assuming this error is created in a separate file, and passed into this file as an argumentconsterr=newError('Boom!');err.foo='bar';constserializedErr=stdSerializers.err(err);serializedErr.foo=err.foo;pino.error(serializedErr);
The text was updated successfully, but these errors were encountered:
I'm trying to log an error object, that has some extra context. The error serializer ignores anything but
type
,message
andstack
. Would you consider extending theerror
serializer to make it hydrate the resulting_err
object with the extra fields it may have? Or should I rather use thepino-std-serializers
directly, serialize my error object directly, then hydrate it and then pass it to pino?Example:
Here's the interim solution I have:
The text was updated successfully, but these errors were encountered: