Module: Skywalking::Log::Logging

Instance Method Summary collapse

Instance Method Details

#debug(msg, *args) ⇒ Object



23
24
25
# File 'lib/skywalking/log/logger.rb', line 23

def debug(msg, *args)
  log(:debug, msg, *args)
end

#error(msg, *args) ⇒ Object



31
32
33
# File 'lib/skywalking/log/logger.rb', line 31

def error(msg, *args)
  log(:error, msg, *args)
end

#info(msg, *args) ⇒ Object



19
20
21
# File 'lib/skywalking/log/logger.rb', line 19

def info(msg, *args)
  log(:info, msg, *args)
end

#log(level, msg, *args) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/skywalking/log/logger.rb', line 35

def log(level, msg, *args)
  logger = Agent.logger
  if logger
    if logger.respond_to?(level)
      if args.empty?
        logger.send(level, msg)
      else
        logger.send(level, format(msg, *args))
      end
    else
      Kernel.warn("Unknown log level: #{level}")
    end
  end
rescue Exception => e
  puts "log exception: #{e.message}"
end

#warn(msg, *args) ⇒ Object



27
28
29
# File 'lib/skywalking/log/logger.rb', line 27

def warn(msg, *args)
  log(:warn, msg, *args)
end