Sha256: 71a5c682ec1201ff44c2b29d020886658d3be61e466984c4ab0aa68501c60904

Contents?: true

Size: 1.04 KB

Versions: 14

Compression:

Stored size: 1.04 KB

Contents

require 'logger'
module S3backup
  class S3log
    @@log_file = nil
    @@debug = false
    def S3log.get_logger
      unless @@log_file 
        @@log_file = Logger.new($stderr) 
        @@log_file.level = Logger::INFO
      end
      return @@log_file
    end
    def S3log.set_level(level)
      unless @@debug 
        case level
        when /debug/i
          get_logger.level = Logger::DEBUG
        when /info/i
          get_logger.level = Logger::INFO
        when /warn/i
          get_logger.level = Logger::WARN
        when /error/i
          get_logger.level = Logger::ERROR
        end
      end
    end
    def S3log.set_debug(flg)
      @@debug=flg
      if @@debug 
        get_logger.level = Logger::DEBUG
      end
    end
    def S3log.error(str)
      get_logger.error(str)
    end
    def S3log.info(str)
      get_logger.info(str)
    end
    def S3log.warn(str)
      get_logger.warn(str)
    end
    def S3log.debug(str)
      get_logger.debug(str)
    end
    def S3log.set_logfile(f)
      @@log_file = Logger.new(f)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
s3backup-0.8.8 lib/s3backup/s3log.rb
s3backup-0.8.7 lib/s3backup/s3log.rb
s3backup-0.8.6 lib/s3backup/s3log.rb
s3backup-0.8.5 lib/s3backup/s3log.rb
s3backup-0.8.4 lib/s3backup/s3log.rb
s3backup-0.8.3 lib/s3backup/s3log.rb
s3backup-0.8.2 lib/s3backup/s3log.rb
s3backup-0.8.1 lib/s3backup/s3log.rb
s3backup-0.7.3 lib/s3backup/s3log.rb
s3backup-0.7.2 lib/s3backup/s3log.rb
s3backup-0.7.01 lib/s3backup/s3log.rb
s3backup-0.6.10 lib/s3backup/s3log.rb
s3backup-0.6.9 lib/s3backup/s3log.rb
s3backup-0.6.8 lib/s3backup/s3log.rb