Support string interpolation
Closed this issue · 2 comments
fagnercarvalho commented
It would be nice to support string interpolation so instead of doing this:
logger.LogInformation("Test {Response}", response);
We could just do this:
logger.LogInformation($"Test {response}");
Just to clarify, both of these include the log but only the first one adds the response
variable as a log property.
nblumhardt commented
Thanks for the suggestion! A bit has been written on this already; unfortunately the design of string interpolation in C# makes it hard to do this well. I think this article and the comments capture the main issues/thinking: https://nblumhardt.com/2015/01/c-6-string-interpolation-and-serilog/
fagnercarvalho commented
It seems like I'm late to the party.
I thought this "new" C# feature could be used in this context but you made some excellent points in your article.
I'm closing this issue.
Thank you for your fast response!