Skip to content

Update logging to use generated logs #2529

@JamesNK

Description

@JamesNK

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions