grpc/grpc-dotnet

Update logging to use generated logs

JamesNK opened this issue · 0 comments

Logging makes heavy use of LoggerMessage.Define. It provides named, structured logging with good performance.
https://github.com/grpc/grpc-dotnet/blob/3ed9fb9f31474b4d1318051123a37d9b6f68cda4/src/Grpc.AspNetCore.Server/Internal/GrpcServerLog.cs

Logging code can be simplified and reduced by using generated logs:
https://learn.microsoft.com/en-us/dotnet/core/extensions/logger-message-generator

I think now that Microsoft.Extensions.Logging is 6.0+ we should be able to use this feature.

Note that there are a lot of logs. It will be a fair bit of work to do all of them. I don't think there is anything stopping one type at a time from being updated.