lib/tee_logger.rb in tee_logger-2.3.1 vs lib/tee_logger.rb in tee_logger-2.4.0
- old
+ new
@@ -101,10 +101,16 @@
end
# @todo Too miscellaneous
# @param target [String, Symbol]
def disable(target)
- instance_variable_get("@#{target}").formatter = proc { |_, _, _, _| '' }
+ if block_given?
+ disable(target)
+ yield
+ enable(target)
+ else
+ instance_variable_get("@#{target}").formatter = proc { |_, _, _, _| '' }
+ end
end
# @todo Too miscellaneous
# @param target [String, Symbol]
def enable(target)