Sha256: dd3b7b5d8fd0e0e9d0a1e0016b7ef4019bbe96c529ce2c03d008e344016c02b8

Contents?: true

Size: 828 Bytes

Versions: 12

Compression:

Stored size: 828 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, 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, true)}  Context: #{context}"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kms_encrypted-1.5.0 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.4.0 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.3.0 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.2.4 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.2.3 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.2.2 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.2.1 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.2.0 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.1.1 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.1.0 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.0.1 lib/kms_encrypted/log_subscriber.rb
kms_encrypted-1.0.0 lib/kms_encrypted/log_subscriber.rb