# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true require 'contrast/agent/reporting/settings/syslog' module Contrast module Agent module Reporting module Settings # this class will hold the security logger settings. class SecurityLogger def initialize @blank = true end # check to see if object is being used # # @return [Boolean] def settings_blank? @blank end # Set the state of settings # # @return [Boolean] def not_blank! @blank = false end # The level at which the agent should log. Overridden by agent.logger.level # if set in a local configuration # # @return log_level [String] [ ERROR, WARN, INFO, DEBUG, TRACE ] def log_level @_log_level ||= Contrast::Utils::ObjectShare::EMPTY_STRING end # set the log level # # @param log_level [String] # @return log_level [String] [ ERROR, WARN, INFO, DEBUG, TRACE ] def log_level= log_level @_log_level = log_level if log_level.is_a?(String) end # Where to log the agent's log file, if set by the user. Overridden by agent.logger.path # if set in a local configuration. # # @return log_file [String] path def log_file @_log_file ||= Contrast::Utils::ObjectShare::EMPTY_STRING end # Set the log file # # @param log_file [String] path # @return log_file [String] path def log_file= log_file @_log_file = log_file if log_file.is_a?(String) end def syslog @_syslog ||= Contrast::Agent::Reporting::Settings::Syslog.new end def to_controlled_hash { level: log_level, path: log_file, syslog: syslog.to_controlled_hash } end end end end end end