Sha256: 791f80c0c3df9eae65b12a07848a6466051d38b8912588e9f50842c6c46fb8a5
Contents?: true
Size: 1.42 KB
Versions: 18
Compression:
Stored size: 1.42 KB
Contents
# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/agent/reporting/settings/log_enhancer' module Contrast module Agent module Reporting module Settings # Reaction the agent should take based on a state in TS. class Reaction attr_accessor :level, :operation, :message # used to check the parameters and also before reactions settings update OPERATIONS = %w[NOOP DISABLE].cs__freeze # Reaction the agent should take based on a state in TS. # # @param level [String] The level at which the agent should log this reaction[ERROR, WARN, INFO, DEBUG, TRACE] # @param message [String] A message to log when receiving this reaction. # @param operation [String] What to do in response to this reaction.[NOOP, DISABLE] def initialize level, operation, message @level = level if Contrast::Agent::Reporting::Settings::LogEnhancer::LOG_LEVELS.include?(level) @operation = operation if OPERATIONS.include?(operation) @message = message if message.is_a?(String) end def to_controlled_hash { message: message, level: level, operation: operation } end end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems