module PrePlay

Public Class Methods

Event(event_type, data = {}, context = {}, opts = nil) click to toggle source
# File lib/preplay/event.rb, line 3
def self.Event(event_type, data = {}, context = {}, opts = nil)
  e = Event.new(
    {
      'type' => event_type
    }.merge(filter(data, event_type)),
    context,
    {
      'dyno'=> $dyno_name,
      'created_at'=> Time.now.to_s
    }
  )
  e.to_scrolls(opts)
end
filter(data, event_type) click to toggle source

will filter the hash that was given to keep only the data that we want to display on the logs depending on the data type

# File lib/preplay/event.rb, line 18
def self.filter(data, event_type)
  return {} unless PrePlay::Event.configuration.field_whitelist.has_key?(event_type)
  data.select {|k| PrePlay::Event.configuration.field_whitelist[event_type].include?(k)}
end