Sha256: a01536b189f5892f751e4b768db48371c5bf82fb05570a1406618842fadf5559

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

module KmsEncrypted
  class LogSubscriber < ActiveSupport::LogSubscriber
    def decrypt(event)
      return unless logger.debug?

      data_key = event.payload[:data_key]
      name = data_key ? "Decrypt Data Key" : "Decrypt"
      name += " (#{event.duration.round(1)}ms)"
      context = event.payload[:context]
      context = context.inspect if context.is_a?(Hash)
      debug "  #{color(name, YELLOW, bold: true)}  Context: #{context}"
    end

    def encrypt(event)
      return unless logger.debug?

      data_key = event.payload[:data_key]
      name = data_key ? "Encrypt Data Key" : "Encrypt"
      name += " (#{event.duration.round(1)}ms)"
      context = event.payload[:context]
      context = context.inspect if context.is_a?(Hash)
      debug "  #{color(name, YELLOW, bold: true)}  Context: #{context}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kms_encrypted-1.6.0 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.5.1 lib/kms_encrypted/log_subscriber.rb