Class: Magellan::Gcs::Proxy::ProgressNotifierAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/magellan/gcs/proxy/progress_notifier_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ ProgressNotifierAdapter

Returns a new instance of ProgressNotifierAdapter.



8
9
10
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 8

def initialize(logger)
  @logger = logger
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 7

def logger
  @logger
end

Instance Method Details

#ltsv(hash) ⇒ Object



12
13
14
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 12

def ltsv(hash)
  hash.map { |k, v| "#{k}:#{v}" }.join("\t")
end

#notify(severity, job_message, data, attrs) ⇒ Object



16
17
18
19
20
# File 'lib/magellan/gcs/proxy/progress_notifier_adapter.rb', line 16

def notify(severity, job_message, data, attrs)
  d = { job_message_id: job_message.message_id }.merge(attrs)
  d[:data] = data # Show data at the end of string
  logger.send(severity, ltsv(d))
end