Sha256: ed983c0a1df3800b2e6f08d46b0ad98a3f851ca91382badc7094a66a6285e39d

Contents?: true

Size: 850 Bytes

Versions: 27

Compression:

Stored size: 850 Bytes

Contents

class Verdict::EventLogger
  attr_reader :logger, :level

  def initialize(logger, level = :info)
    @logger, @level = logger, level
  end

  def log_assignment(assignment)
    status = assignment.returning? ? 'returning' : 'new'
    if assignment.qualified?
      logger.send(level, "[Verdict::Assignment] experiment=#{assignment.experiment.handle} subject=#{assignment.subject_identifier} status=#{status} qualified=true group=#{assignment.group.handle}")
    else
      logger.send(level, "[Verdict::Assignment] experiment=#{assignment.experiment.handle} subject=#{assignment.subject_identifier} status=#{status} qualified=false")
    end 
  end

  def log_conversion(conversion)
    logger.send(level, "[Verdict::Conversion] experiment=#{conversion.experiment.handle} subject=#{conversion.subject_identifier} goal=#{conversion.goal}")
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
verdict-0.3.2 lib/verdict/event_logger.rb
verdict-0.3.1 lib/verdict/event_logger.rb
verdict-0.3.0 lib/verdict/event_logger.rb
verdict-0.2.1 lib/verdict/event_logger.rb
verdict-0.2.0 lib/verdict/event_logger.rb
verdict-0.1.1 lib/verdict/event_logger.rb
verdict-0.1.0 lib/verdict/event_logger.rb