Add conditional compilation of logging functions.

This should gain performance by removing additional (and useless in production) function calls and reduce compiled files size.

I didn't make analysis with Scout but it's obvious optimization and should definitely give us some speedup.

related to #191