Sha256: c27e6effde8b5f34dc1944e7c4aa76201e3060494a2129205ffbacdeb7612488

Contents?: true

Size: 631 Bytes

Versions: 7

Compression:

Stored size: 631 Bytes

Contents

require 'logger'

class SidekickLogger < Logger
  CONNECTION_LOSS_SLEEP_RETRY = 5
  
  def format_message(severity, timestamp, msg, progname) 
    "#{timestamp.strftime("%b %d %H:%M:%S")} sidekick[#{Process.pid}] #{severity}: #{progname.to_s.gsub(/\n/, '').lstrip}\n"
  end
  
  def log_connection_error_and_sleep(e)
    self.warn %{Caught a potential RabbitMQ connection loss, or server down. Will attempt to re-initialize and sleep for #{CONNECTION_LOSS_SLEEP_RETRY} seconds, and attempt to reconnect. Exception details: #{e.class}: #{e.message} #{e.backtrace.join("\n")}}    
    sleep(CONNECTION_LOSS_SLEEP_RETRY)    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sidekick-client-0.2.5 lib/sidekick/shared/sidekick_logger.rb
sidekick-client-0.2.4 lib/sidekick/shared/sidekick_logger.rb
sidekick-client-0.2.3 lib/sidekick/shared/sidekick_logger.rb
sidekick-client-0.2.2 lib/sidekick/shared/sidekick_logger.rb
sidekick-client-0.2.1 lib/sidekick/shared/sidekick_logger.rb
sidekick-client-0.2.0 lib/sidekick/shared/sidekick_logger.rb
sidekick-client-0.1.0 lib/sidekick/shared/sidekick_logger.rb