Class: Coursemology::Evaluator::Logging::ClientLogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/coursemology/evaluator/logging/client_log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#allocate(event) ⇒ Object



7
8
9
# File 'lib/coursemology/evaluator/logging/client_log_subscriber.rb', line 7

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

#allocate_fail(e:) ⇒ Object



11
12
13
# File 'lib/coursemology/evaluator/logging/client_log_subscriber.rb', line 11

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

#evaluate(event) ⇒ Object



15
16
17
18
# File 'lib/coursemology/evaluator/logging/client_log_subscriber.rb', line 15

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

#publish(name, *args) ⇒ Object



3
4
5
# File 'lib/coursemology/evaluator/logging/client_log_subscriber.rb', line 3

def publish(name, *args)
  send(name.split('.').first, *args)
end

#save(event) ⇒ Object



20
21
22
# File 'lib/coursemology/evaluator/logging/client_log_subscriber.rb', line 20

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