Dotnet-IO-logger / core

Dotnet Input output logger
https://marketplace.visualstudio.com/items?itemName=Diol.diol
MIT License
29 stars 1 forks source link

Support failed http requests #52

Open OlzhabaevSh opened 3 months ago

OlzhabaevSh commented 3 months ago

Is your feature request related to a problem? Please describe. if a http request fails, we have no logs :-(

Describe the solution you'd like We need to have something to show to a user.

Describe alternatives you've considered We need to contribute to dotnet source code.

Additional context The reason why we have nothing is because dotnet extension doesn't show failed logs here.

OlzhabaevSh commented 3 months ago

Created an issue in dotnet repo: https://github.com/dotnet/runtime/issues/106284

OlzhabaevSh commented 3 months ago

PR: https://github.com/dotnet/runtime/pull/106964

OlzhabaevSh commented 2 months ago

After merging the PR we can use the next example how to extract exception message:

public override BaseDto GetLogDto(int eventId, TraceEvent value)
{
    var exceptionJson = value.PayloadByName("ExceptionJson")?.ToString();
    var exceptionArguments = JsonConvert.DeserializeObject<Dictionary<string, string>>(exceptionJson);

    var exceptionMessage = exceptionArguments["Message"];

    return null;
}
OlzhabaevSh commented 2 months ago

PR: dotnet/runtime#106964

the PR has been merged.