Module: Workers::Helpers

Included in:
Pool, Scheduler, Task, TaskGroup, Timer, Worker
Defined in:
lib/workers/helpers.rb

Instance Method Summary collapse

Instance Method Details

#concat_e(msg, e = nil) ⇒ Object



19
20
21
# File 'lib/workers/helpers.rb', line 19

def concat_e(msg, e = nil)
  e ? "#{msg}\nEXCEPTION: #{e.message}\n#{e.backtrace.join("\n")}\n--" : msg
end

#log_debug(msg, e = nil) ⇒ Object



3
4
5
# File 'lib/workers/helpers.rb', line 3

def log_debug(msg, e = nil)
  (@_logger || @logger).debug(concat_e(msg, e))
end

#log_error(msg, e = nil) ⇒ Object



15
16
17
# File 'lib/workers/helpers.rb', line 15

def log_error(msg, e = nil)
  (@_logger || @logger).error(concat_e(msg, e))
end

#log_info(msg, e = nil) ⇒ Object



7
8
9
# File 'lib/workers/helpers.rb', line 7

def log_info(msg, e = nil)
  (@_logger || @logger).info(concat_e(msg, e))
end

#log_warn(msg, e = nil) ⇒ Object



11
12
13
# File 'lib/workers/helpers.rb', line 11

def log_warn(msg, e = nil)
  (@_logger || @logger).warn(concat_e(msg, e))
end