Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Laravel 10 compatibility processor configurations #49

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

Open
mvsvolkov wants to merge 2 commits into hedii:master
base: master
Choose a base branch
Loading
from mvsvolkov:feature/laravelProcessorConfigurationCompatible

Conversation

@mvsvolkov
Copy link

@mvsvolkov mvsvolkov commented Jan 29, 2024

Adding Laravel 10 compatibility for logger processors configuration

https://laravel.com/docs/10.x/logging#monolog-processors

Original code can by found here:

https://github.com/illuminate/log/blob/cf040cfddc30d5746554f173fc9c1f535077af45/LogManager.php#L409

mvsvolkov, VitekSkrip, and SergeyZhigalo reacted with laugh emoji mvsvolkov, VitekSkrip, and SergeyZhigalo reacted with heart emoji
Copy link
Owner

hedii commented Jan 29, 2024

Hello, thanks for this PR.

Can you explain briefly what is the purpose of the options (with) when configuring processors?

Maybe you can share a Processor you are using with my package that can benefit from defining options?

Copy link
Author

Hello, thanks for this PR.

Can you explain briefly what is the purpose of the options (with) when configuring processors?

Maybe you can share a Processor you are using with my package that can benefit from defining options?

Hello, this is a parameters for Processor construct method.

  • Processor can use another services, and when you create it with Container, they can be automatically injected
  • Processor can have some configuration, that you can set with with configuration for constructor

For example https://github.com/Seldaek/monolog/blob/main/src/Monolog/Processor/MemoryProcessor.php this processor have two options, and with with config, you can override them

[
 'processor' => Monolog\Processor\MemoryUsageProcessor::class,
 'with' => ['useFormatting' => env('USE_FORMATTING_MEMORY', false)]
]

In our cases Graylog has limitation for context item size, we have to split it into the chunks to avoid missed message parts. We use constructor parameters to define size of this chunks

'processors' => [
 ...,
 [
 'processor' => GraylogContextFragmentationProcessor::class,
 'with' => [
 'contextChunkSize' => env('GRAYLOG_CONTEXT_CHUNK_SIZE', 25),
 ],
 ],
 ],

Copy link
Owner

hedii commented Jan 29, 2024

Ok thanks.

Can I see your GraylogContextFragmentationProcessor::class to fully understand and write a test for this new feature?

Copy link
Author

mvsvolkov commented Jan 29, 2024
edited
Loading

Ok thanks.

Can I see your GraylogContextFragmentationProcessor::class to fully understand and write a test for this new feature?

This class has a lot of project specific code =)

For example, i add feature to existing RequestIdProcessor, for change recorder field name, and add test to it.

[
 'processor' => \Hedii\LaravelGelfLogger\Processors\RenameIdFieldProcessor::class,
 'with' => [
 'fieldName' => '_other_id',
 ],
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /