-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Layout.CreateFromString with throwConfigExceptions parameter #3771
Conversation
e1ed7ee
to
f68b246
Compare
I prefer the It's really how MS is doing things and a "throw exception flag" is a known code smell AFAIK. The only reason for not use the try-pattern is consistency which the current API (not the case I think). So I vote for TryCreateFromString+CreateFromString :) |
Since But then I don't really need |
Yes indeed.
Not for this case indeed. But I like it as it's easier to use from the client. (no need to do a catch). |
Ok what method should you call to get the default behavior where SimpleLayout replaces unknown renderers with literals ? |
Ow forgot about that. (I wrote it myself years ago I think, lol). Maybe we should keep it like this then :) |
…uncLayoutRenderer-tests to SimpleLayoutParserTests
f68b246
to
11097d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
Updated wiki: https://github.com/NLog/NLog/wiki/Configure-from-code |
Trying to prevent cases where people globally enabled LogManager.ThrowExceptions to perform Layout-validation. See also:
elmahio/elmah.io.nlog@f26377e
And moved FuncLayoutRenderer-tests to SimpleLayoutParserTests.
Could also be convinced to rename it to TryCreateFromString. But then I'm not allowed to throw exception with reason why (and where) it failed.