Skip to content

[14.x] feat: allow per-report log levels - #61694

Merged
taylorotwell merged 1 commit into
laravel:masterfrom
calebdw:calebdw/push-xrkoknkqtyzp
Sep 24, 2026
Merged

taylorotwell merged 1 commit into
laravel:masterfrom
calebdw:calebdw/push-xrkoknkqtyzp

Conversation

@calebdw

@calebdw calebdw commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Hello!

There's been many times where I've wanted/needed to report an exception with a given level, in light of call-site context, rather than using the global defaults. This PR adds a level parameter to the report methods to achieve that---if null then the default behaviour is preserved:

try {
    // something
} catch (Throwable $t) {
    report($t, level: LogLevel::DEBUG);
}

cc: @timacdonald

Note

There's a chicken-egg problem here: orchestral/testbench-core#427 is the companion PR

Thanks!

Let callers override an individual exception's severity without a
global exception-class mapping.
@timacdonald

timacdonald commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

I think this is pretty interesting and useful!

Right now, the only signal we have is handled vs unhandled, however that is not a great indicator of criticality.

It is in indicator that a user had a bad experience, sure, but a handled exception stopping users from signing up is more critical than an unhandled exception that occurs when a random setting hardly anyone touches throws when you toggle it.

This would allow us to communicate the business criticality of exceptions, which I'm all for.

@taylorotwell
taylorotwell merged commit 4a757eb into laravel:master Sep 24, 2026
5 of 48 checks passed
@calebdw
calebdw deleted the calebdw/push-xrkoknkqtyzp branch September 24, 2026 19:03
crynobone pushed a commit to orchestral/testbench-core that referenced this pull request Sep 26, 2026
Keep Testbench's exception handler compatible with the level-aware report
signature introduced by laravel/framework#61694.
binaryfire added a commit to hypervel/components-backup that referenced this pull request Oct 1, 2026
Forward an optional log level through the exception handler contract, helpers, testing wrappers and fakes. An explicit report level takes precedence over the exception-type default while preserving report context and cancellation handling. Update handler implementations, generated facade annotations and reporting expectations, and document the public helper argument.

Upstream:
laravel/framework#61694

Source: laravel/framework master 7068848dfe48fc3a433598e09ce798799d442a52.
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.

3 participants