class Vx::Lib::Instrumentation::Logger

Attributes

logger[RW]

Public Class Methods

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

Public Instance Methods

method_missing(sym, *args, &block) click to toggle source
Calls superclass method
# File lib/vx/lib/instrumentation/logger.rb, line 13
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/lib/instrumentation/logger.rb, line 26
def respond_to?(sym)
  @device.respond_to?(sym)
end