Sha256: 8ca942fc5144fdb99cccef5d7f7748579f4fedbde985cec0ef21a15df1a280e1

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

require 'logger'

module SqsPoller
  module Logger
    class << self

      @logger_file = nil
      @logger = nil
      @log_level

      def get_new_logger (prog_name = nil, log_level = nil)
        if @logger_file.nil?
          logger = ::Logger.new(STDOUT)
        else
          logger = ::Logger.new(@logger_file)
        end
        @log_level = @log_level || ::Logger::ERROR
        logger.level = log_level || @log_level
        logger.progname = prog_name
        logger
      end

      def set_log_level (log_level)
        @log_level = log_level
      end

      def set_logger_file (logger_file)
        @logger_file = logger_file
      end

      def get_logger
        if @logger.nil?
          @logger = get_new_logger
        end
        @logger
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fourkites-sqspoller-v2-1.0.0 lib/sqspoller/logger/logger.rb