Added condition to log statements, if enabled by user.