Class: KmsEncrypted::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/kms_encrypted/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#decrypt(event) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/kms_encrypted/log_subscriber.rb', line 3

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

#encrypt(event) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/kms_encrypted/log_subscriber.rb', line 14

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