module ElasticAPM::Logging
@api private
Constants
- LEVELS
- PREFIX
Public Instance Methods
debug(msg, *args, &block)
click to toggle source
# File lib/elastic_apm/logging.rb, line 18 def debug(msg, *args, &block) log(:debug, msg, *args, &block) end
error(msg, *args, &block)
click to toggle source
# File lib/elastic_apm/logging.rb, line 30 def error(msg, *args, &block) log(:error, msg, *args, &block) end
fatal(msg, *args, &block)
click to toggle source
# File lib/elastic_apm/logging.rb, line 34 def fatal(msg, *args, &block) log(:fatal, msg, *args, &block) end
info(msg, *args, &block)
click to toggle source
# File lib/elastic_apm/logging.rb, line 22 def info(msg, *args, &block) log(:info, msg, *args, &block) end
warn(msg, *args, &block)
click to toggle source
# File lib/elastic_apm/logging.rb, line 26 def warn(msg, *args, &block) log(:warn, msg, *args, &block) end
Private Instance Methods
log(lvl, msg, *args)
click to toggle source
# File lib/elastic_apm/logging.rb, line 40 def log(lvl, msg, *args) return unless (logger = @config&.logger) return unless LEVELS[lvl] >= (@config&.log_level || 0) formatted_msg = prepend_prefix(format(msg.to_s, *args)) return logger.send(lvl, formatted_msg) unless block_given? logger.send(lvl, "#{formatted_msg}\n#{yield}") end
prepend_prefix(str)
click to toggle source
# File lib/elastic_apm/logging.rb, line 51 def prepend_prefix(str) "#{PREFIX}#{str}" end