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

use Monolog's FormatterInterface format method original signature #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

remitamine
Copy link

the original Monolog's FormatterInterface format method signature does not impose any return type while the ElasticCommonSchemaFormatter does impose a return type of string:

public function format(LogRecord $record): string

this change removes this limitation so it's possible to override the format method and return a different type(ex: array).

the usecase i have here is that i want to combine the ElasticCommonSchemaFormatter with a monolog handler that uses the fluent logger to send logs to fluent-bit, fluent-bit's forward protocol accept only messages in msgpack format, so messages are packed using msgpack php extension, since the message are encoded in a format other then JSON, there is no need here to encode the ecs message to json(currently it's automatically done in the format method)


and then later decode it, instead i would need only the formatted array so it can be further packed into a msgpack to be sent to fluent-bit.

Copy link

❌ Author of the following commits did not sign a Contributor Agreement:
4df4b6b

Please, read and sign the above mentioned agreement if you want to contribute to this project

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.

1 participant