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

Support UInt32 and UInt64 in Log Context #14459

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

toddsundsted
Copy link
Contributor

This PR adds support for UInt32 and UInt64 values in the Log context.

I often want to add a request id to every log message in an HTTP request handler. The reasonable solution is something like:

Log.context.set request_id: request.object_id

But this doesn't work, because object_id is a UInt64 and isn't supported in a log context (see here and here).

For consistency with other supported primitive values, this PR adds support for UInt32 and UInt64. It doesn't add support for all of the other primitive and value types. (I can be persuaded, but the supported set will never realistically be exhaustive.)

Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me 👍

@straight-shoota straight-shoota added this to the 1.13.0 milestone Apr 9, 2024
@straight-shoota straight-shoota merged commit 246cd7c into crystal-lang:master Apr 16, 2024
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants