Module: Pulp::Common::Debug::ClassMethods

Defined in:
lib/pulp/common/debug.rb

Instance Method Summary collapse

Instance Method Details

#debug(msg) ⇒ Object



31
32
33
# File 'lib/pulp/common/debug.rb', line 31

def debug(msg)
    output.puts msg if @debug_enabled
end

#debug_enabledObject



13
14
15
# File 'lib/pulp/common/debug.rb', line 13

def debug_enabled
    @debug_enabled ||= false
end

#debug_enabled=(enable) ⇒ Object



17
18
19
20
# File 'lib/pulp/common/debug.rb', line 17

def debug_enabled=(enable)
    @debug_enabled = enable
    self.output = self.output # reset output to activate it
end

#outputObject



27
28
29
# File 'lib/pulp/common/debug.rb', line 27

def output
    @output ||= STDERR
end

#output=(o) ⇒ Object



22
23
24
25
# File 'lib/pulp/common/debug.rb', line 22

def output=(o)
    @output = o
    RestClient.log = debug_enabled ? output : nil
end