class Object

Public Instance Methods

logged_task(*args) { || ... } click to toggle source

Wrapper for task

  • Automatically creates a ProcessLog

  • Captures any errors with stack trace

# File lib/duffy_log/engine.rb, line 20
def logged_task(*args, &block)
  task *args do |task|
    log = ProcessLog.create(key: task.to_s)
    begin
      yield
      log.success!
    rescue StandardError => e
      log.fail!(e)
    end
  end
end