Skip to content
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

Custom request payload format #40

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

davidslaby
Copy link

Allows devs to customize payload in JSON format
+
README updated

@davidslaby
Copy link
Author

Tested by me - fully working solution

@davidslaby
Copy link
Author

@kutuluk @Looooopy @roblangridge could you check please? :)

Thanks in advance!

@Iorweth333
Copy link

Iorweth333 commented Aug 9, 2021

Perhaps an option to turn off interpolation and export of the interpolate function would do the trick?
Personally, all I wanted was to receive my args in the format funtion unchanged so that I could add some additional information in each log in JSON format, like:

const customJSON = (log, args) => ({ msg: log.message, additionalInformation: args, level: log.level.label, });
so that in the end I could receive something like this:
{ "logs":[ { "msg":"Error during parsing", "additionalInformation":{ "message":"InvalidTokenError: Invalid token specified: JSON.parse: unexpected character at line 1 column 1 of the JSON data", "parsed":"XD" }, "level":"error" } ] }

but that interpolation unfortunately mashed it all into a string...

@davidslaby
Copy link
Author

Perhaps an option to turn off interpolation and export of the interpolate function would do the trick?
Personally, all I wanted was to receive my args in the format funtion unchanged so that I could add some additional information in each log in JSON format, like:

const customJSON = (log, args) => ({ msg: log.message, additionalInformation: args, level: log.level.label, });
so that in the end I could receive something like this:
{ "logs":[ { "msg":"Error during parsing", "additionalInformation":{ "message":"InvalidTokenError: Invalid token specified: JSON.parse: unexpected character at line 1 column 1 of the JSON data", "parsed":"XD" }, "level":"error" } ] }

but that interpolation unfortunately mashed it all into a string...

Perhaps I don't understand your reply. My PR was about completely different thing, I need to send log in different format to remote not to add some information.

@Iorweth333
Copy link

oh, that was the point, pardon me then

@davidslaby
Copy link
Author

oh, that was the point, pardon me then

It's okay, descriptions is too short. I'm sending that to logz.io and the format is determined by object. So there was not any option to send logs like objects not in array by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants