sting.Format suggestion #100259
Unanswered
JustinMDotNet
asked this question in
Ideas
sting.Format suggestion
#100259
Replies: 2 comments 5 replies
-
So effectively, you are asking for replacing placeholder indexes with names. Generally we are suggesting moving away from |
Beta Was this translation helpful? Give feedback.
2 replies
-
@stephentoub Thoughts? Should we expose LogValuesFormatter. I'm not sure how common this scenario is. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
My team uses the new ILogger from the Microsoft.Extensions.Logging library and are running into an issue utilizing the Message Template format with the
Logger.LogError
method and with thestring.Format
method. See use case below.In this case, we're creating a custom dimension for the user in our logs but the message returned to our user would be "{User} not found". If we tried to utilize the
string.Format
method it fails because it expectsstring.format("{0}", user)
. Atm I've written a custom extension method to parse this out but I'd imagine this is a use case for everyone following this pattern. Could this be included as another overload for string.Format in the future or possibly a different method altogether?Thnx
Beta Was this translation helpful? Give feedback.
All reactions