Created
January 3, 2014 12:55
-
-
Save j1n6/8237477 to your computer and use it in GitHub Desktop.
Ruby Multiple IO
This file contains 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
class MultipleIO | |
def initialize(*targets) | |
@targets = targets | |
end | |
def write(*args) | |
@targets.each { |t| t.write(*args) } | |
end | |
def close | |
@targets.each(&:close) | |
end | |
end |
This file contains 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
Hulk::Application.configure do | |
# ... | |
# other config settings for development | |
# ... | |
log_file = File.open("log/development.log", "a") | |
config.logger = Logger.new MultiIO.new(STDOUT, log_file) | |
config.logger.level = Logger.const_get('DEBUG') | |
# ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment