rollbar / rollbar-php

Error tracking and logging from PHP to Rollbar
https://docs.rollbar.com/docs/php
MIT License
334 stars 120 forks source link

Logger sends context in body and custom #389

Closed ajtran closed 6 years ago

ajtran commented 6 years ago

(internal) https://app.intercom.io/a/apps/rlisg82q/inbox/inbox/849049/conversations/17694320596

it seems that for rollbar-php v1.5.3 w/ monolog, when a user is making a call to

$logger->pushHandler(new PsrHandler(
Rollbar::logger(), LOG_LEVEL))

and pass psr7 request/response as an array to the third argument (more on this below), the body and custom objects are populated with the same data as seen here (internal) https://rollbar.com/gvera/Sivi/items/55/occurrences/47606157814/

the user has done some more debugging and reported that Rollbar logger works with four params (level, message, context, is_uncaught)

when the payload is built it goes to DataBuilder for body construct which ends up including context data (array with PSR7 objects)

and finally when the custom part is built, it includes again the context merging it with an empty custom array, thus the same object in body and custom.

is this the desired behavior?

here’s a screenshot of the code

https://downloads.intercomcdn.com/i/o/69414339/520accc56444fca21ff67d66/image.png

gveraa commented 6 years ago

Hi Guys, if any doubt or more info required please let me know

Regards

gveraa commented 6 years ago

Hi, any comments on this?

rivkahstandig3636 commented 6 years ago

Hi @gveraa, sorry for the delay! @ArturMoczulski could you please take a look into this?

ArturMoczulski commented 6 years ago

Fixed in master. Will be released in v1.7.0.