Skip to content

Need better clarification on when this interface should be implemented #11372

Open
@mtaylorfsmb

Description

@mtaylorfsmb

Type of issue

Missing information

Description

This interface seems to add async versions of the standard IHttpClientLogger interface to a logger. But it is unclear when and why a logger should implement it. The documentation states this interface is used for async calls and the standard interface is used for sync calls. However, outside of an optimization, the standard interface is called for sync and async calls. The benefit of this interface seems to only be for making async calls as part of the interface instead of making async, blocking calls in the normal sync method.

I this the documentation should be updated to explain why this interface would be implemented, since it doesn't seem to matter how it is actually called as the docs would suggest. It would also be useful to see or describe a typical implementation of what that might look like. For example if a logger decided to implement both interfaces then we wouldn't replicate the code in both interfaces but rather have one version, say the async code, call the other version, say the sync code. It isn't clear what the best practice is here. A clear example would be most useful.

Page URL

https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.http.logging.ihttpclientasynclogger?view=net-9.0-pp

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/Microsoft.Extensions.Http.Logging/IHttpClientAsyncLogger.xml

Document Version Independent Id

c11115d1-aa99-f864-c711-565c9f67314a

Platform Id

4b385300-1d4e-9d35-e87a-cd5599f73832

Article author

@dotnet-bot

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions