Class: Soda::Logger::JobLogger

Inherits:
Object
  • Object
show all
Includes:
Tools
Defined in:
lib/soda/logger.rb

Constant Summary

Constants included from Tools

Tools::TID_KEY

Instance Method Summary collapse

Methods included from Tools

#deep_symbolize_keys, #now, #sqs, #tid

Constructor Details

#initialize(logger = Soda.logger) ⇒ JobLogger

Returns a new instance of JobLogger.



49
50
51
# File 'lib/soda/logger.rb', line 49

def initialize(logger = Soda.logger)
  @logger = logger
end

Instance Method Details

#with(job_hash) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'lib/soda/logger.rb', line 53

def with(job_hash)
  logger.with([:worker, job_hash["klass"]], [:jid, job_hash["id"]]) do
    start = now
    logger.info("start")

    yield

    logger.info("finish (%fms)" % (now - start))
  end
end