opcodesio/log-viewer

It strips out JSON fragments from a message

lezhnev74 opened this issue ยท 4 comments

I just found out that the current version (2.5.2) strips out chunks of the message's body.

For example, a message contains this snippet:

...
Headers: {
    "x-goog-api-client": "gl-php\/8.2.8 gccl\/19.2.0 gapic\/19.2.0 gax\/1.19.1 grpc\/1.56.0 rest\/1.19.1 pb\/3.23.4+c",
    ...
}
Request: 
...

But in the log-viewer we see this:

...
Headers: 
Request: 
...

Could you advice how to configure log-viewer to show the full bodies of messages?

Hey @lezhnev74 , log viewer extracts any json from the message and prints it as "context". You should be able to see it in the UI, or on the "context" attribute via the API.

That is because Laravel puts log context as json, so to then convert it back from text, we have to extract any json and treat it as context ๐Ÿ˜€

Does that make sense? Do you think the logic could be improved somehow?

Sure, I follow the logic and see why that is so. I wonder if theres a way to not strip json parts? It'd be perfect to see the whole message as is (plain text). If not, can I contribute a patch or something like that to make it happen? We use the library and enjoy it much.

hey @lezhnev74 , I've tagged a new version v2.5.4 which now includes ability to leave JSON objects intact within the log.

Go to config/log-viewer.php and add this at the end:

    'strip_extracted_context' => false,

it will still extract context, but it won't remove it from the rest of the log.

Hope this helps! :)

Wow, thank you @arukompas ! We are giving this a shot and I'll be back next week ๐Ÿ™