Sha256: 597777f8840abfc0f01fbdf84ab32d83e392decf68357ad011d7869af4e47c3e

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

# encoding: utf-8

module AMQP
  class Failover
    class Logger
      
      attr_accessor :enabled
      
      def initialize(enabled = nil)
        @enabled = enabled || true
      end
      
      def error(*msg)
        msg[0] = "[ERROR]: " + msg[0] if msg[0].is_a?(String)
        write(*msg)
      end
      
      def info(*msg)
        write(*msg)
      end
      
      private
      
      def write(*msg)
        return if !@enabled
        puts *msg
      end
      
    end # Logger
  end # Failover
end # AMQP

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
amqp-failover-0.0.3 lib/amqp/failover/logger.rb
amqp-failover-0.0.2 lib/amqp/failover/logger.rb
amqp-failover-0.0.1 lib/amqp/failover/logger.rb