NLog/NLog — pull request #286 by roji (2013-12-20 09:06:07+00:00)
Title: Made Trace methods DEBUG-Conditional

I am not sure that this PR is correct, but would like to start a conversation (or at least find if one occurred...).

My application is speed-critical, and in many critical paths we cannot place trace/debug messages because we don't want to slow our release build down: the actual calling of the function and the check whether trace/debug is enabled is too much.

Our current workaround is an NLog wrapper with [Conditional("DEBUG")] on the trace methods. This automatically strips out all Trace calls in our release build, but keeps them in the debug build. We have an internal discussion whether this should happen even for Debug calls.

I'm not sure everyone would agree that totally disabling Trace in release is a good idea (at the very least it's a non-trivial change), but for performance-sensitive applications it's a must.

Good idea? Bad idea?