Repository navigation
Fix PHP Monolog LogsHandler constructor in logs docs - #19640
Conversation
LogsHandler in sentry/sentry 4.x only takes a level (and bubble). The logs setup snippet still passed a Hub, so the sample could not run.
|
@Hashim1999164 is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
| ]); | ||
|
|
||
| $log = new Logger('app'); | ||
| $log->pushHandler(new \Sentry\Monolog\LogsHandler( |
There was a problem hiding this comment.
https://github.com/getsentry/sentry-php/blob/75d09d8df75298c165961697be93a88e7dfbde78/src/Monolog/LogsHandler.php#L38 this misses the second argument.
There was a problem hiding this comment.
good catch, LogsHandler is (logLevel, bubble). updated the sample to pass true for bubble. Monolog\Level::Info is still valid there too (constructor takes LogLevel|Monolog\Level|int).
LogsHandler takes (logLevel, bubble). Keep the level and set bubble true so the sample matches the constructor.
0a08b13 to
da3cf18
Compare
|
good catch, LogsHandler is (logLevel, bubble). updated the sample to pass true for bubble. |
|
Hi @Hashim1999164! It's a bit unfortunate but we added a 3rd parameter in todays release: https://github.com/getsentry/sentry-php/blob/master/src/Monolog/LogsHandler.php#L46 Could you update it, the rest looks good |
|
@Litarnus updated, added the third includeChannel arg (false) so the sample matches the current LogsHandler ctor. |
LogsHandler now takes (logLevel, bubble, includeChannel). Keep the sample in sync with the current constructor.
cdcd517 to
4eb546a
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
DESCRIBE YOUR PR
Fixes #19177
The PHP logs setup snippet still constructed LogsHandler with a Hub argument. In sentry/sentry 4.x that constructor only takes a log level (and bubble), so the sample failed as written. Updated it to match the working 4.x call.
IS YOUR CHANGE URGENT?
PRE-MERGE CHECKLIST
LEGAL BOILERPLATE
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Test plan