-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pass data to a stream without serializing it #400
Comments
I have a similar issue. Our I would personally like to have the req/res/err serializers do their thing automatically, but I would like my 'stream' to receive the Javascript object containing the entry, rather than the serialized entry. I'm not sure if that is practical or not. |
After digging more, I think you can achieve this by specifying
I do think the stream itself should be able to declare it requires raw data, rather than having to declare it at the configuration level. |
I can confirm that |
It seems to me like |
I have the exact same problem integrating with Azure Application Insights, which also needs the Error object in order to log an exception. Specifying This hack will give the actual Error object to a Is there another way for the stream to consistently get the actual Error object that was logged without breaking the serializer contract? |
@kayjtea If it's any consolation, this is still a problem for me as well.
This way, err doesn't get touched at all. I still think that serializers should be defined on the stream level instead of globally, not sure why it wasn't designed like that. |
@trentm I would be up for taking a first pass at adding stream specific serializers if you would be in favor of that feature. Any potential complications to look out for? |
@pwmckenna If the stream-specific serializers exactly specify the set of serializers to use for the stream AND this set is allowed to be empty then this would address "pass data to a stream without serializing". |
FYI, I entered #553 to support serializers per stream. |
Right now I have two streams on the same logger - stdout and another one that sends logs to a third party service (opbeat.com).
Opbeat agent expects a standard js error object (or subclass) to be passed so it can show it with all the context in their dashboard.
Problem is that if I use Bunyan's std error serializer, error object gets transformed into a plain object with some properties from the original error. I then have to try and recreate the error from that plain object just so it could be sent to Opbeat correctly (it actually proved to be more difficult than I thought - mderazon/bunyan-opbeat#1).
Using Bunyan's std serializer is nice because then you get all kind of cool formatting on stdout, but at the same time we lose the ability for other streams to process the original data.
I don't know if this need has come up before, I couldn't find it in any other issue but I don't think it's limited to this specific stream.
Possible solutions for this:
serialize
boolean flag to the stream that if set to 'false', tells Bunayn to pass data as is and not use serializers. (default should be 'true' so maybe a better name is needed)Is there any nice and clean solution I can use that doesn't require any change to Bunyan ?
The text was updated successfully, but these errors were encountered: