- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
So TWTF is that it throws a NullReferenceException if message is empty? Seems a bit minor, unless that Conditions thing has some other exception logic.
Admin
For those interested: "Geen data om te loggen" can be translated to: "No data to log". which would actually never be reached because the first if statement alters message.
Admin
Oops it would actually be reached. my bad
Admin
LogMessageWithArguments("{0}", "") would log an empty message if all those checks weren't there. What's the WTF?
Admin
Log()
already has an overload that does formattingAdmin
TRWTF is that this is a Remy Porter article and the one HTML comment he added isn't funny.
Admin
Admin
true enough. personally i would expect the behavior that when
we never do around these parts. that is our curse, and also our joy. we can argue for **weeks** about what the correct solution should be, regardless of the actual requirements and ignoring other system constraints! there is no excuse for lazy.... no excuse at all. :tangerine: yeah. long standing "bug" that. supposedly it's by design (or rather by spec. Markdown lists define that behavior.)Log()
is called the appropriate logging entry is generated. if i passed an empty string to it then that's my problemLog()
should still log it.Admin
Logging functions throwing is bad, because you can't log it and it means the original log is lost. I've had some nasty problems where I couldn't trace the source of an error until I realised the logging was failing so I was looking in the wrong place
Admin
Why not? Recursive logging FTW!
Filed Under: It's logs all the way down!
Admin
Error: An error was encountered while logging the error
Admin
Yes, you can! You just need a separate logging framework for logging the failures in logging…
Admin
It's logging, all the way down!
Admin
No, the WTF is that it is going to fail if the string is null and the args are not. Sort of half-defensive code. :facepalm:
Admin
Error: An error was encountered while encountering an error.
Admin
It's yo-dawg-ception for errors!
Admin
Admin
Admin
Try running
string.Format("","This","Will","Totally","Work")
.