Displaying 1 result from an estimated 1 matches for "silence_logger".
2007 Nov 16
1
Temporaly silencing the rails log.
Hi! I want to do what subject say. Is there any elegant way to do this:
???
# Silence the log inside the block attached to the method call.
def silence_logger
orig= nil
ObjectSpace.each_object(::Logger) do |logger|
logger.info "-" * 80
logger.info "Quieting the log..."
orig= logger.level
logger.level= ::Logger::FATAL
end
yield
ObjectSpace.each_object(::Logger) do |logger|
logger.level= orig
logger....