Module: Jets::Event::Helpers::LogEvent

Included in:
Base
Defined in:
lib/jets/event/helpers/log_event.rb

Instance Method Summary collapse

Instance Method Details

#log_eventObject



8
9
10
11
12
13
14
15
# File 'lib/jets/event/helpers/log_event.rb', line 8

def log_event
  encoded = event["awslogs"]["data"]
  compressed_string = Base64.decode64(encoded)
  gz = Zlib::GzipReader.new(StringIO.new(compressed_string))
  uncompressed_string = gz.read
  data = JSON.load(uncompressed_string)
  ActiveSupport::HashWithIndifferentAccess.new(data)
end

#log_event?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/jets/event/helpers/log_event.rb', line 17

def log_event?
  !!event.dig("awslogs", "data")
end