Overrode RubyDNS::Transaction.respond! to use debug logger instead.

Now all RubyDNS output is properly disabled unless --verbose is given.
This commit is contained in:
soh_cah_toa
2013-05-07 23:59:27 -04:00
parent c7981f3c0d
commit d24a00a639

View File

@@ -5,7 +5,7 @@
#
module RubyDNS
# Overrides RubyDNS::run_server() to behave exactly the same, minus the output
# Behaves exactly the same, minus the output
def self.run_server(options = {}, &block)
server = RubyDNS::Server.new(&block)
@@ -28,4 +28,24 @@ module RubyDNS
server.fire(:stop)
end
class Transaction
# Behaves exactly the same, except using debug logger instead of info
def respond!(*data)
options = data.last.kind_of?(Hash) ? data.pop : {}
resource_class = options[:resource_class] || @resource_class
if resource_class == nil
raise ArgumentError, "Could not instantiate resource #{resource_class}!"
end
@server.logger.debug "Resource class: #{resource_class.inspect}"
resource = resource_class.new(*data)
@server.logger.debug "Resource: #{resource.inspect}"
append!(resource, options)
end
end
end