Added Layout.CreateFromString with throwConfigExceptions parameter#3771
Added Layout.CreateFromString with throwConfigExceptions parameter#3771repo-ranger[bot] merged 1 commit intoNLog:masterfrom
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
|
Kudos, SonarCloud Quality Gate passed!
|
|
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.