Top Level Namespace

Defined Under Namespace

Modules: DuffyLog, ProcessLogBase Classes: ProcessLog, ProcessLogsController

Instance Method Summary collapse

Instance Method Details

#logged_task(*args, &block) ⇒ Object

Wrapper for task

  • Automatically creates a ProcessLog

  • Captures any errors with stack trace



20
21
22
23
24
25
26
27
28
29
30
# 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