lib/semantic_logger/log.rb in semantic_logger-4.2.2 vs lib/semantic_logger/log.rb in semantic_logger-4.3.0
- old
+ new
@@ -107,13 +107,13 @@
self.level_index = SemanticLogger.level_to_index(level)
end
end
if backtrace
- self.backtrace = Utils.cleanse_backtrace(backtrace)
+ self.backtrace = Utils.extract_backtrace(backtrace)
elsif level_index >= SemanticLogger.backtrace_level_index
- self.backtrace = Utils.cleanse_backtrace
+ self.backtrace = Utils.extract_backtrace
end
if metric
self.metric = metric
self.metric_amount = metric_amount
@@ -147,11 +147,11 @@
# Add result of block as message or payload if not nil
if block_given? && (result = yield)
if result.is_a?(String)
message = message.nil? ? result : "#{message} -- #{result}"
assign(message: message, payload: payload, exception: exception)
- elsif message.nil? && result.is_a?(Hash) && [:message, :payload, :exception].any? { |k| result.key? k }
+ elsif message.nil? && result.is_a?(Hash) && %i[message payload exception].any? { |k| result.key? k }
assign(result)
elsif payload&.respond_to?(:merge)
assign(message: message, payload: payload.merge(result), exception: exception)
else
assign(message: message, payload: result, exception: exception)
@@ -293,11 +293,11 @@
# Lazy initializes the context hash and assigns a key value pair.
def set_context(key, value)
(self.context ||= {})[key] = value
end
- # A metric only event has a metric but no message, exception, or payload.
+ # A metric only event has a metric but no message or exception.
def metric_only?
- metric && message.nil? && exception.nil? && payload.nil?
+ metric && message.nil? && exception.nil?
end
end
end