module RabbitFeed

Constants

VERSION

Attributes

application[RW]
configuration_file_path[RW]
environment[RW]
log[RW]

Public Instance Methods

configuration() click to toggle source
# File lib/rabbit_feed.rb, line 31
def configuration
  @configuration ||= (Configuration.load configuration_file_path, environment, application)
end
default_logger() click to toggle source
# File lib/rabbit_feed.rb, line 47
def default_logger
  if File.directory? 'log'
    Logger.new 'log/rabbit_feed.log', 10, 100.megabytes
  else
    Logger.new STDOUT
  end.tap do |log|
    log.formatter = RabbitFeed::JsonLogFormatter
    log.level     = Logger::INFO
  end
end
exception_notify(exception) click to toggle source
# File lib/rabbit_feed.rb, line 35
def exception_notify(exception)
  return unless defined?(Airbrake)
  if RabbitFeed.configuration.consumer_exit_after_fail
    # Will need to send the notification right away, otherwise the `exit` would kill the
    # Airbrake before the notification is sent out
    Airbrake.notify_sync exception
  else
    # Airbrake notify default to sending notification asynchronously
    Airbrake.notify exception
  end
end

Private Instance Methods

set_defaults() click to toggle source
# File lib/rabbit_feed.rb, line 58
def set_defaults
  self.log                     ||= default_logger
  self.configuration_file_path ||= 'config/rabbit_feed.yml'
  self.environment             ||= ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
end