Sha256: 23893084020fa995e4ffa1e713a28f0b42891aa297968af3c8a5065b3437779d

Contents?: true

Size: 588 Bytes

Versions: 3

Compression:

Stored size: 588 Bytes

Contents

module RedisFailover
  # Common utiilty methods.
  module Util
    extend self

    def symbolize_keys(hash)
      Hash[hash.map { |k, v| [k.to_sym, v] }]
    end

    def self.logger
      @logger ||= begin
        logger = Logger.new(STDOUT)
        logger.level = Logger::INFO
        logger.formatter = proc do |severity, datetime, progname, msg|
          "#{datetime.utc} RedisFailover #{Process.pid} #{severity}: #{msg}\n"
        end
        logger
      end
    end

    def self.logger=(logger)
      @logger = logger
    end

    def logger
      Util.logger
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis_failover-0.2.0 lib/redis_failover/util.rb
redis_failover-0.1.1 lib/redis_failover/util.rb
redis_failover-0.1.0 lib/redis_failover/util.rb