Module: Dumper::Utility::Log

Included in:
Agent, Job
Defined in:
lib/dumper/utility/log.rb

Instance Method Summary collapse

Instance Method Details

#log(msg, level = :info) ⇒ Object



14
15
16
17
18
# File 'lib/dumper/utility/log.rb', line 14

def log(msg, level=:info)
  stdout_logger.send level, "** [Dumper] " + msg
  return unless true #should_log?
  logger.send level, msg
end

#log_last_errorObject



20
21
22
23
# File 'lib/dumper/utility/log.rb', line 20

def log_last_error
  log [ $!.class.name, $!.to_s ].join(', ')
  log ("\n" << $!.backtrace.join("\n")), :debug
end

#loggerObject



6
7
8
# File 'lib/dumper/utility/log.rb', line 6

def logger
  @@logger ||= Dumper::Utility::SlimLogger.new("#{Rails.root}/log/dumper_agent.log", 1, 10.megabytes)
end

#stdout_loggerObject



10
11
12
# File 'lib/dumper/utility/log.rb', line 10

def stdout_logger
  @@stdout_logger ||= Dumper::Utility::SlimLogger.new(STDOUT)
end