Sha256: 7cb694a7cf5eb0057e39e58fb6cb0cb48e840f0870776ec7bb2a39ca3cf68ff3

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'datadog/appsec/waf/lib_ddwaf'

require 'datadog/appsec/waf/converter'
require 'datadog/appsec/waf/result'
require 'datadog/appsec/waf/context'
require 'datadog/appsec/waf/handle'
require 'datadog/appsec/waf/version'

module Datadog
  module AppSec
    module WAF
      module_function

      def version
        LibDDWAF.ddwaf_get_version
      end

      def log_callback(level, func, file, line, message, len)
        return if WAF.logger.nil?

        WAF.logger.debug do
          {
            level: level,
            func: func,
            file: file,
            line: line,
            message: message.read_bytes(len)
          }.inspect
        end
      end

      def logger
        @logger
      end

      def logger=(logger)
        unless @log_callback
          log_callback = WAF.method(:log_callback)
          LibDDWAF.ddwaf_set_log_cb(log_callback, :ddwaf_log_trace)

          # retain logging proc if set properly
          @log_callback = log_callback
        end

        @logger = logger
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
libddwaf-1.18.0.0.0-aarch64-linux lib/datadog/appsec/waf.rb
libddwaf-1.18.0.0.0-x86_64-linux lib/datadog/appsec/waf.rb
libddwaf-1.18.0.0.0-java lib/datadog/appsec/waf.rb
libddwaf-1.18.0.0.0-aarch64-linux-gnu lib/datadog/appsec/waf.rb
libddwaf-1.18.0.0.0-arm64-darwin lib/datadog/appsec/waf.rb
libddwaf-1.18.0.0.0-x86_64-darwin lib/datadog/appsec/waf.rb
libddwaf-1.18.0.0.0-x86_64-linux-gnu lib/datadog/appsec/waf.rb
libddwaf-1.18.0.0.0 lib/datadog/appsec/waf.rb