Skip to content

Conversation

@ramasai1
Copy link
Contributor

@ramasai1 ramasai1 commented Nov 11, 2022

log.Message() can be called multiple times after the Log object has been constructed, and each time it'll print the formatted over and over again. This PR introduces a way in which evaluation happens once, and the formatted log is stored in the Log and is returned without any cost.

QA: ./run-tests shows everything in v2 passing.

cc @dunkyboy

Context *Context

// Appendages to evaluate a message only once
message string

Choose a reason for hiding this comment

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

What is the lifecycle of a Log struct? We've now ~doubled the effective size of it, assuming MessageFmt (and now message) is long compared to the other fields...

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.

2 participants