class Logging::LogEvent
This class defines a logging event.
Attributes
Public Class Methods
Source
# File lib/logging/log_event.rb, line 29 def initialize( logger, level, data, caller_tracing ) self.logger = logger self.level = level self.data = data self.time = Time.now.freeze if caller_tracing stack = Kernel.caller[CALLER_INDEX] return if stack.nil? match = CALLER_RGXP.match(stack) self.file = match[1] self.line = Integer(match[2]) self.method_name = match[3] unless match[3].nil? if (bp = ::Logging.basepath) && !bp.empty? && file.index(bp) == 0 self.file = file.slice(bp.length + 1, file.length - bp.length) end else self.file = self.line = self.method_name = '' end end
Creates a new log event with the given logger name, numeric level, array of data from the user to be logged, and boolean caller_tracing flag. If the caller_tracing flag is set to true
then Kernel::caller will be invoked to get the execution trace of the logging method.