class Vx::Instrumentation::Logger

Attributes

logger[RW]

Public Class Methods

new(device) click to toggle source
# File lib/vx/instrumentation/logger.rb, line 11
def initialize(device)
  @device = device
end
setup(target) click to toggle source
# File lib/vx/instrumentation/logger.rb, line 35
def setup(target)
  log = ::Logger.new(target, 7, 50_000_000)
  log.formatter = Formatter
  @logger = new(log)
end

Public Instance Methods

method_missing(sym, *args, &block) click to toggle source
Calls superclass method
# File lib/vx/instrumentation/logger.rb, line 15
def method_missing(sym, *args, &block)
  if @device.respond_to?(sym)
    begin
      @device.send(sym, *args, &block)
    rescue Exception => e
      $stderr.puts "#{e.class.to_s}, #{e.message.inspect} [#{sym.inspect} #{args.inspect}]"
      $stderr.puts e.backtrace.map{|b| "\t#{b}" }.join("\n")
    end
  else
    super
  end
end
respond_to?(sym) click to toggle source
# File lib/vx/instrumentation/logger.rb, line 28
def respond_to?(sym)
  @device.respond_to?(sym)
end