Sha256: 1b98c9d7c09f343e0f588bb759f7f1b587ca60b0a8f025dbe928785c6fbba039

Contents?: true

Size: 786 Bytes

Versions: 3

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true
class Coursemology::Evaluator::Logging::ClientLogSubscriber < ActiveSupport::LogSubscriber
  def publish(name, *args)
    send(name.split('.').first, *args)
  end

  def allocate(event)
    info color("Client: Allocate (#{event.duration.round(1)}ms)", MAGENTA)
  end

  def allocate_fail(e:)
    error color("Client: Allocate failed: #{e.message}", RED)
  end

  def evaluate(event)
    info "#{color("Client: Evaluate (#{event.duration.round(1)}ms)", CYAN)} "\
      "#{event.payload[:evaluation].language.class.display_name}"
  end

  def save(event)
    info color("Client: Save (#{event.duration.round(1)}ms)", GREEN)
  end
end

Coursemology::Evaluator::Logging::ClientLogSubscriber.attach_to(:'client.evaluator.coursemology')

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coursemology-evaluator-0.1.6 lib/coursemology/evaluator/logging/client_log_subscriber.rb
coursemology-evaluator-0.1.4 lib/coursemology/evaluator/logging/client_log_subscriber.rb
coursemology-evaluator-0.1.3 lib/coursemology/evaluator/logging/client_log_subscriber.rb