elastic / ecs-dotnet

https://www.elastic.co/guide/en/ecs-logging/dotnet/current/setup.html
Apache License 2.0
114 stars 58 forks source link

Use Convert instead of cast for formatting ElapsedMilliseconds #344

Closed ixnas closed 10 months ago

ixnas commented 10 months ago

For a project I'm using SerilogWeb.Classic to log HTTP requests. The ECS formatter crashed when it tried to cast ElapsedMilliseconds from a message template, because SerilogWeb.Classic passed a long, while the ECS formatter expected a double.

Because the property is boxed, the formatter would crash when trying to cast a boxed long to a double.

I can't find any specification on the specific type that this property should have, so I figured the formatter should be agnostic about the exact numerical type.

cla-checker-service[bot] commented 10 months ago

❌ Author of the following commits did not sign a Contributor Agreement: 8e2e6fce19819ca14fa16ccbe91ecb26cfbe36d4

Please, read and sign the above mentioned agreement if you want to contribute to this project