Created
March 29, 2010 05:25
-
-
Save davidlee/347460 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MultiLogger | |
def also_log_to file, &block | |
@_original_logger, self.logger = logger, ActiveSupport::BufferedLogger.new(file) | |
yield | |
self.logger, @_original_logger = logger, nil | |
end | |
end | |
# in application.rb: | |
include MultiLogger | |
def also_log_to_another_logger &block | |
also_log_to '/tmp/another.log', &block | |
end | |
around_filter :also_log_to_another_logger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment