In my F# code I have a lot of logging. Something like this
logger.Log (sprintf "%A" (this.GetSomething parameters))
It all works well but the performance is low even with NullLogger due to a lot of sprintf calls. The string parameter for the log call is fully formed and then beign ignored at the end inside Log function
Is there a good way to completely switch off logging? Of course I could do preprocessor directives (are there such thing in F#?) or somehow use 'if flag then ....' but I am wondering if there is a F# magic which would do it nicely for me?