Sha256: f3bfa180b6b3e638cfd71dab2661b6d1a40bdb8df5a7e2d96f8fc5109c9c5258

Contents?: true

Size: 715 Bytes

Versions: 4

Compression:

Stored size: 715 Bytes

Contents

# frozen_string_literal: true

require 'wisper'
require 'ditty/models/audit_log'
require 'ditty/services/logger'

module ProxES
  class Listener
    def es_request_failed(request, response)
      Ditty::AuditLog.create(
        action: :es_request_failed,
        user: request.user,
        details: "#{request.detail} > #{response[0]}"
      )
    end

    def es_request_denied(request, exception = nil)
      detail = request.detail
      detail = "#{detail} - #{exception.class}" if exception
      Ditty::AuditLog.create(
        action: :es_request_denied,
        user: request.user,
        details: detail
      )
    end
  end
end

Wisper.subscribe(ProxES::Listener.new) unless ENV['RACK_ENV'] == 'test'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proxes-0.9.13 lib/proxes/services/listener.rb
proxes-0.9.12 lib/proxes/services/listener.rb
proxes-0.9.9 lib/proxes/services/listener.rb
proxes-0.9.7 lib/proxes/services/listener.rb