Sha256: f9e5f97e6b0f03e897efac484c7ac888ca1cc03dc8aad696ef33993cd4f93953
Contents?: true
Size: 650 Bytes
Versions: 1
Compression:
Stored size: 650 Bytes
Contents
# frozen_string_literal: true module Loggery module Util def log_job_runtime(job_type, job_instance_name = nil) job_name = ["Job type #{job_type}", job_instance_name].compact.join " - " Rails.logger.info event_type: :"#{job_type}_started", message: "#{job_name} started" begin start_time = Time.current yield if block_given? ensure end_time = Time.current duration = end_time - start_time Rails.logger.info event_type: :"#{job_type}_finished", message: "#{job_name} finished", duration: duration end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
loggery-0.1.0 | lib/loggery/util.rb |