Module: IrbLogger

Included in:
IRB::WorkSpace
Defined in:
src/lib/installation/console.rb

Overview

Override the IRB to log all executed commands into the y2log so we know what exactly happened there (in case user did something wrong or strange...)

Instance Method Summary collapse

Instance Method Details

#evaluate(*args) ⇒ Object

wrap the original "evaluate" method, do some logging around



25
26
27
28
29
30
31
32
33
34
35
36
# File 'src/lib/installation/console.rb', line 25

def evaluate(*args)
  statements = args[1]
  # do not log the internal IRB command for setting the last value variable
  if statements.is_a?(::String) && statements.start_with?("_ = ")
    super
  else
    Yast::Y2Logger.instance.info "Executing console command: #{statements.inspect}"
    ret = super
    Yast::Y2Logger.instance.info "Console command result: #{ret.inspect}"
    ret
  end
end