Module: DNS

Defined in:
lib/faildns/type.rb,
lib/faildns/ip.rb,
lib/faildns/class.rb,
lib/faildns/qtype.rb,
lib/faildns/client.rb,
lib/faildns/common.rb,
lib/faildns/header.rb,
lib/faildns/qclass.rb,
lib/faildns/server.rb,
lib/faildns/message.rb,
lib/faildns/question.rb,
lib/faildns/domainname.rb,
lib/faildns/header/type.rb,
lib/faildns/header/opcode.rb,
lib/faildns/header/status.rb,
lib/faildns/resourcerecord.rb,
lib/faildns/server/dispatcher.rb,
lib/faildns/resourcerecord/IN/A.rb,
lib/faildns/resourcerecord/data.rb,
lib/faildns/resourcerecord/IN/MX.rb,
lib/faildns/resourcerecord/IN/NS.rb,
lib/faildns/resourcerecord/IN/PTR.rb,
lib/faildns/resourcerecord/IN/SOA.rb,
lib/faildns/resourcerecord/IN/TXT.rb,
lib/faildns/resourcerecord/IN/AAAA.rb,
lib/faildns/resourcerecord/IN/NULL.rb,
lib/faildns/resourcerecord/IN/CNAME.rb,
lib/faildns/resourcerecord/IN/HINFO.rb,
lib/faildns/server/dispatcher/event.rb,
lib/faildns/server/dispatcher/socket.rb,
lib/faildns/server/dispatcher/eventdispatcher.rb,
lib/faildns/server/dispatcher/connectiondispatcher.rb

Overview

– Copyleft meh. [meh.doesntexist.org | [email protected]]

This file is part of faildns.

faildns is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

faildns is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with faildns. If not, see <www.gnu.org/licenses/>. ++

Defined Under Namespace

Classes: Class, Client, DomainName, Header, IP, Message, QClass, QType, Question, ResourceRecord, Server, Type

Constant Summary collapse

Version =
'0.0.1'

Class Method Summary collapse

Class Method Details

.debug(argument, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/faildns/common.rb', line 23

def self.debug (argument, options={})
  if !ENV['DEBUG']
    return
  end

  if ENV['DEBUG'].to_i < (options[:level] || 1)
    return
  end

  output = "From: #{caller[0, options[:deep] || 1].join("\n")}\n"

  if argument.is_a?(Exception)
    output << "#{argument.class}: #{argument.message}\n"
    output << argument.backtrace.collect {|stack|
      stack
    }.join("\n")
    output << "\n\n"
  elsif argument.is_a?(String)
    output << "#{argument}\n"
  else
    output << "#{argument.inspect}\n"
  end

  if options[:separator]
    output << options[:separator]
  end

  puts output
end