Class: Lumberjack::RemapAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/lumberjack/remap_attribute.rb

Overview

This class can be used as a return value from an AttributeFormatter to indicate that the value should be remapped to a new attribute name.

Examples:

# Transform duration_millis and duration_micros to seconds and move to
# the duration attribute.
logger.formatter.format_attribute_name("duration_ms") do |value|
  Lumberjack::RemapAttribute.new("duration" => value.to_f / 1000)
end
logger.formatter.format_attribute_name("duration_micros") do |value|
  Lumberjack::RemapAttribute.new("duration" => value.to_f / 1_000_000)
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(remapped_attributes) ⇒ RemapAttribute



20
21
22
# File 'lib/lumberjack/remap_attribute.rb', line 20

def initialize(remapped_attributes)
  @attributes = Lumberjack::Utils.flatten_attributes(remapped_attributes)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



17
18
19
# File 'lib/lumberjack/remap_attribute.rb', line 17

def attributes
  @attributes
end