Skip to content

Conversation

@TheJokr
Copy link

@TheJokr TheJokr commented Oct 10, 2025

This impl allows using LazyLock like an FnValue. The notable difference is that LazyLock memoizes the function's result, whereas FnValue generates a fresh result every time. This is relevant when values are stored in a Logger for multiple log calls.

Closes #360

TheJokr and others added 2 commits October 10, 2025 12:10
This impl allows using `LazyLock` like an `FnValue`. The notable
difference is that `LazyLock` memoizes the function's result, whereas
`FnValue` generates a fresh result every time. This is relevant when
values are stored in a `Logger` for multiple log calls.

Closes slog-rs#360
No reason to do one and not the other.
@Techcable Techcable self-requested a review October 11, 2025 10:23
@Techcable Techcable self-assigned this Oct 11, 2025
@Techcable Techcable self-requested a review October 11, 2025 10:42
@Techcable
Copy link
Member

Thank you! I will squash & merge this before the v2.9.0 release :)

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.

Lazy and cached log fields

2 participants