Sha256: 7687ee1637a25411ea723d4170bca9c44d81fdda2b7a1a232af72e81487b6272

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/logger/log'
require 'contrast/logger/cef_log'
require 'contrast/components/base'

module Contrast
  module Components
    module Logger # :nodoc:
      module InstanceMethods # :nodoc:
        def logger
          Contrast::Logger::Log.instance.logger
        end

        def cef_logger
          @_cef_logger ||= Contrast::Logger::CEFLog.instance.tap(&:build_logger)
        end

        def add_trace_perf_logging_for sym, custom_message = nil
          logger.add_trace_perf_logging(self, sym, custom_message)
        end
      end

      class << self
        def add_trace_log_timing_for clazz, method_name, custom_message = nil
          Contrast::Logger::Log.instance.add_method_to_trace_timing(clazz, method_name, custom_message)
        end
      end

      # So This class here follows the update for the configuration
      # and from know on ( if it's as we planned it to be) it will hold the
      # instance methods and will initialize new instances for where they're needed
      class Interface
        include InstanceMethods

        # @return [String, nil]
        attr_accessor :path
        # @return [String, nil]
        attr_accessor :level
        # @return [String, nil]
        attr_accessor :progname

        def initialize hsh = {}
          return unless hsh

          @path = hsh[:path]
          @level = hsh[:level]
          @progname = hsh[:progname]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
contrast-agent-6.6.0 lib/contrast/components/logger.rb
contrast-agent-6.5.1 lib/contrast/components/logger.rb
contrast-agent-6.5.0 lib/contrast/components/logger.rb