I'm trying to build a target for a cloud logging system (Rollbar) that accepts object parameters in its log calls, and parses that object and displays individual keys in the web UI. A sample log call would be:
logger.info('apples vs. oranges', { apples: foo, oranges: bar });
Problem is that the target function receives the message already formatted as string. Sending that raw string to the logging service is a no-go. In order to reconstruct my original object, I have to JSON.parse() the message argument. This is slow and roundabout.
I also need to scrub the severity and message fields from the object, because they're already included in the call itself.
It would be great if Bristol made available the original message arugment(s), perhaps as rest parameters to the target function.
I'm trying to build a target for a cloud logging system (Rollbar) that accepts object parameters in its log calls, and parses that object and displays individual keys in the web UI. A sample log call would be:
Problem is that the target function receives the message already formatted as string. Sending that raw string to the logging service is a no-go. In order to reconstruct my original object, I have to
JSON.parse()
themessage
argument. This is slow and roundabout.I also need to scrub the
severity
andmessage
fields from the object, because they're already included in the call itself.It would be great if Bristol made available the original message arugment(s), perhaps as rest parameters to the target function.
In the meantime, here's the code I'm using: