Sha256: 6d34727cc8420c2794cb9c4a3ccf40372c755342804588963934f0d50363f2c2

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 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

4 entries across 4 versions & 1 rubygems

Version Path
coursemology-evaluator-0.1.9 lib/coursemology/evaluator/logging/client_log_subscriber.rb
coursemology-evaluator-0.1.8 lib/coursemology/evaluator/logging/client_log_subscriber.rb
coursemology-evaluator-0.1.7 lib/coursemology/evaluator/logging/client_log_subscriber.rb
coursemology-evaluator-0.1.1 lib/coursemology/evaluator/logging/client_log_subscriber.rb