Skip to content

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