Azure / Azure/durabletask

StructuredLogEvent does not satisfy a common approach for TState of ILogger

Open
#617 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.7k
Forks
335
Avg merge
2d 23h
Merged PRs (30d)
6

Description

The current implementation of `StructuredLogEvent` does not satisfy the common approach for `TState` provided for logger. The usual one provides the formatting message as the last one key value pair as visible below

https://github.com/dotnet/runtime/blob/ce99c5658cc8c6ef426f54864d394ba443820840/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LoggerMessage.cs#L504-L531

while the `StructuredLogEvent` returns only the properties with `StructuredLogFieldAttribute`.

https://github.com/Azure/durabletask/blob/8d45ab7428c8e51f95d04a6a601a02e860451108/src/DurableTask.Core/Logging/StructuredLogEvent.cs#L99-L122

What's the reason for this discrepancy?

Additional note: in the [ApplicationInsights logger](https://github.com/microsoft/ApplicationInsights-dotnet/blob/a350e899e7690126dcea64c37ef936b92908a295/LOGGING/src/ILogger/ApplicationInsightsLogger.cs#L94) the `formatter` is used anyway, but other logging tools might be just lacking this information.

It would be nice to have it clarified and documented. The current approach for logging could be probably slimmed, if we get this cleared, but the potential work requires clarifying the assumptions behind this decision. The best answer, that the author of this question could dream about would be, _yes, let's align logging with the base logging packages_ 😉

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.