-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Utilize formatted message from AzureEventSourceListener in LogEvent #44048
base: main
Are you sure you want to change the base?
Conversation
API change check API changes are not detected in this pull request. |
I think the desire in the original code is to defer formatting the message until/unless it's absolutely needed. In particular, you want to avoid (expensive) formatting if the log level would otherwise filter the event entirely. I would propose an alternative where we add a second (overloaded) constructor to |
As I read it, the formatting doesn't happen until the event is logged either way. Whether it happens higher or lower in the stack seems immaterial. But perhaps I am missing something? |
Yes, you are missing something. In this PR, message formatting (likely a string allocation) still happens unconditionally inside |
Does the EventSource not avoid the eager formatting when it calls |
Yes, it does. However, this listener subscribes to events at "Verbose" level (meaning everything) and the |
closes #44028
@lmolkova - If this fix makes sense, there are other files where we should make this fix.