Added conditional logic around logging through options