Skip to content

Store native BSON types as-is in the MongoDB formatter #1620

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

Merged
merged 2 commits into from
Mar 13, 2022

Conversation

ellotheth
Copy link
Contributor

I like to throw MongoDB document IDs in my log context so I can cross-reference them later:

$log->info("{$user->email} logged in", [ 'actor' => $user->id ]);

Right now, \Monolog\Formatter\MongoDBFormatter flattens ObjectIds into arrays (e.g. [ 'oid' => 'object id string', 'class' => ObjectId::class ]). This PR allows all \MongoDB\BSON\Type implementations to pass through the formatter without additional processing.

Verified

This commit was signed with the committer’s verified signature.
ellotheth Gemma Lynn

Verified

This commit was signed with the committer’s verified signature.
ellotheth Gemma Lynn
@Seldaek Seldaek added this to the 2.x milestone Mar 13, 2022
@Seldaek Seldaek merged commit b39a394 into Seldaek:main Mar 13, 2022
@Seldaek
Copy link
Owner

Seldaek commented Mar 13, 2022

Thanks

@lyrixx lyrixx mentioned this pull request Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants