loglevel-plugin-remote
loglevel-plugin-remote copied to clipboard
Custom request payload format
Allows devs to customize payload in JSON format + README updated
Tested by me - fully working solution
@kutuluk @Looooopy @roblangridge could you check please? :)
Thanks in advance!
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 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.
oh, that was the point, pardon me then
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.