Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Flush monolog state between requests #460

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

nunomaduro
Copy link
Member

This pull request ensures the monolog state - handlers and processors - are reset between requests.

An example is on the usage of FingersCrossedHandler. Previously, when using the FingersCrossedHandler, the following requests printed two logs:

Route::get('/info', fn () => info('info'));
Route::get('/critical', fn () => logger()->critical('critical'));

// 2 requests...
GET /info
GET /critical

// laravel.log (Assuming an `'action_level' => 'critical'`)
line 1: info
line 2: critical

Now, because the FingersCrossedHandler is flushed between requests, the output is:

// 2 requests...
GET /info
GET /critical

// laravel.log (Assuming an `'action_level' => 'critical'`)
line 1: critical

@taylorotwell taylorotwell merged commit 2f21999 into 1.x Jan 10, 2022
@taylorotwell taylorotwell deleted the feat/reset-monolog-state branch January 10, 2022 15:26
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.

2 participants