Class: Contrast::Agent::Reporting::Settings::LogEnhancer

Inherits:
Object
  • Object
show all
Defined in:
lib/contrast/agent/reporting/settings/log_enhancer.rb

Overview

All of the apis to add new logging calls to the application at runtime

Constant Summary collapse

ATTRIBUTES =
%i[id api format level name type].cs__freeze
LOG_LEVELS =
%w[TRACE DEBUG INFO WARN ERROR].cs__freeze
TYPES =
%w[AUDIT ERROR SECURITY].cs__freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#apiObject

Returns the value of attribute api.



17
18
19
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 17

def api
  @api
end

#formatObject

Returns the value of attribute format.



19
20
21
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 19

def format
  @format
end

#idObject

Returns the value of attribute id.



21
22
23
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 21

def id
  @id
end

#nameObject

Returns the value of attribute name.



23
24
25
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 23

def name
  @name
end

Instance Method Details

#levelObject

TRACE, DEBUG, INFO, WARN, ERROR


27
28
29
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 27

def level
  @_level ||= Contrast::Utils::ObjectShare::EMPTY_STRING
end

#level=(new_level) ⇒ Object

TRACE, DEBUG, INFO, WARN, ERROR

Parameters:

  • new_level (String)

    new level to set.



34
35
36
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 34

def level= new_level
  @_level = new_level if LOG_LEVELS.include?(new_level)
end

#to_controlled_hashObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 51

def to_controlled_hash
  {
      id: id,
      api: api,
      format: format,
      name: name, # rubocop:disable Security/Module/Name
      level: level,
      type: type
  }
end

#typeObject

AUDIT, ERROR, SECURITY


40
41
42
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 40

def type
  @_type ||= Contrast::Utils::ObjectShare::EMPTY_STRING
end

#type=(new_type) ⇒ Object

AUDIT, ERROR, SECURITY

Parameters:

  • new_type (String)

    new type to set.



47
48
49
# File 'lib/contrast/agent/reporting/settings/log_enhancer.rb', line 47

def type= new_type
  @_type = new_type if TYPES.include?(new_type)
end