Module: StackifyRubyAPM::Log Private

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

This module will format the process logs perform between the Agent and Web App

Constant Summary collapse

PREFIX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'[StackifyRubyAPM] '.freeze

Instance Method Summary collapse

Instance Method Details

#debug(msg, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/stackify_apm/log.rb', line 9

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

#error(msg, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/stackify_apm/log.rb', line 21

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

#fatal(msg, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/stackify_apm/log.rb', line 25

def fatal(msg, *args, &block)
  log(:fatal, msg, *args, &block)
end

#info(msg, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
# File 'lib/stackify_apm/log.rb', line 13

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

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
34
35
36
37
38
# File 'lib/stackify_apm/log.rb', line 29

def log(lvl, msg, *args)
  return unless logger

  formatted_msg = prepend_prefix(format(msg.to_s, *args))

  return logger.send(lvl, formatted_msg) unless block_given?

  # TODO: dont evaluate block if level is higher
  logger.send(lvl, "#{formatted_msg}\n#{yield}")
end

#warn(msg, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/stackify_apm/log.rb', line 17

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