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.16.1 lib/verdict/event_logger.rb
verdict-0.16.0 lib/verdict/event_logger.rb
verdict-0.15.2 lib/verdict/event_logger.rb
verdict-0.15.1 lib/verdict/event_logger.rb
verdict-0.15.0 lib/verdict/event_logger.rb
verdict-0.14.0 lib/verdict/event_logger.rb
verdict-0.13.0 lib/verdict/event_logger.rb
verdict-0.12.0 lib/verdict/event_logger.rb
verdict-0.11.0 lib/verdict/event_logger.rb
verdict-0.10.0 lib/verdict/event_logger.rb
verdict-0.9.0 lib/verdict/event_logger.rb
verdict-0.8.0 lib/verdict/event_logger.rb
verdict-0.7.0 lib/verdict/event_logger.rb
verdict-0.6.3 lib/verdict/event_logger.rb
verdict-0.6.2 lib/verdict/event_logger.rb
verdict-0.6.1 lib/verdict/event_logger.rb
verdict-0.6.0 lib/verdict/event_logger.rb
verdict-0.5.0 lib/verdict/event_logger.rb
verdict-0.4.1 lib/verdict/event_logger.rb
verdict-0.4.0 lib/verdict/event_logger.rb