Class: Lumberjack::DataDog::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



22
23
24
25
26
27
28
29
30
# File 'lib/lumberjack/data_dog.rb', line 22

def initialize
  @max_message_length = nil
  @backtrace_cleaner = nil
  @thread_name = false
  @pid = true
  @allow_all_tags = true
  @tag_mapping = {}
  @pretty = false
end

Instance Attribute Details

#allow_all_tagsObject

Returns the value of attribute allow_all_tags.



18
19
20
# File 'lib/lumberjack/data_dog.rb', line 18

def allow_all_tags
  @allow_all_tags
end

#backtrace_cleanerObject

Returns the value of attribute backtrace_cleaner.



15
16
17
# File 'lib/lumberjack/data_dog.rb', line 15

def backtrace_cleaner
  @backtrace_cleaner
end

#max_message_lengthObject

Returns the value of attribute max_message_length.



14
15
16
# File 'lib/lumberjack/data_dog.rb', line 14

def max_message_length
  @max_message_length
end

#pidObject

Returns the value of attribute pid.



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

def pid
  @pid
end

#prettyObject

Returns the value of attribute pretty.



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

def pretty
  @pretty
end

#tag_mappingObject (readonly)

Returns the value of attribute tag_mapping.



19
20
21
# File 'lib/lumberjack/data_dog.rb', line 19

def tag_mapping
  @tag_mapping
end

#thread_nameObject

Returns the value of attribute thread_name.



16
17
18
# File 'lib/lumberjack/data_dog.rb', line 16

def thread_name
  @thread_name
end

Instance Method Details

#remap_tags(tag_mapping) ⇒ Object



32
33
34
# File 'lib/lumberjack/data_dog.rb', line 32

def remap_tags(tag_mapping)
  @tag_mapping = @tag_mapping.merge(tag_mapping)
end

#validate!Object



36
37
38
39
40
41
42
43
44
# File 'lib/lumberjack/data_dog.rb', line 36

def validate!
  if !max_message_length.nil? && (!max_message_length.is_a?(Integer) || max_message_length <= 0)
    raise ArgumentError, "max_message_length must be a positive integer"
  end

  unless backtrace_cleaner.nil? || backtrace_cleaner.respond_to?(:clean)
    raise ArgumentError, "backtrace_cleaner must respond to #clean"
  end
end