-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
Use source generated LoggerMessage #1651
Comments
This is obviously not something that needs to be done in one big-bang. In my experience it is smart to just decide on starting somewhere and sticking to it, then it's also easier to continue using it for new log-statements. In terms of performance the best place to start would be where logging happens frequently, if you have a suggestion I would be happy to start this journey |
What I did in Eventuous is to use the EventSource instead, and add an extension for the application builder, which adds a listener that dumps messages produced by the EventSource to catch (Exception e) {
Log.UnableToLoadAggregate<T>(streamName, e);
throw;
} I see that the [Event(TypeMapRegisteredId, Message = "Type {0} registered as {1}", Level = EventLevel.Verbose)]
public void TypeMapRegistered(string type, string typeName) {
if (IsEnabled(EventLevel.Verbose, EventKeywords.All)) WriteEvent(TypeMapRegisteredId, type, typeName);
} |
I'm all for giving the new source-generated logging a try. |
Is it time to start gradually moving over to using Microsoft's source generated LoggerMessage? With the source generated logger message you get multiple things for free. Better performance and less allocations, no need to check if log level is enabled and hiding the actual log messages behind method-names (i.e LogThatXFailed(error)).
Technically I don't think that there is a problem introducing given the target frameworks of these projects.
The text was updated successfully, but these errors were encountered: