Class: Object

Inherits:
BasicObject
Defined in:
lib/failirc/utils.rb

Instance Method Summary collapse

Instance Method Details

#debug(argument, separator = '') ⇒ Object



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/failirc/utils.rb', line 24

def debug (argument, separator='')
    output = ''

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

    if separator
        output << separator
    end

    begin
        if @verbose || (@server && @server.verbose) || (@client && @client.verbose)
            puts output
        end
    rescue
    end

    (dispatcher rescue server.dispatcher rescue client.dispatcher).execute :log, output rescue nil
end