Sha256: 6943d5266e2247968e6c7f1b32a5710c71b95104dcfce712643f5309387a07e7

Contents?: true

Size: 477 Bytes

Versions: 5

Compression:

Stored size: 477 Bytes

Contents

require 'forwardable'
require 'fileutils'
require 'logger'

module TwitterFriendly
  class Logger
    extend Forwardable
    def_delegators :@logger, :debug, :info, :warn, :error, :fatal, :level

    def initialize(options = {})
      path = options[:log_dir] || File.join('log')
      FileUtils.mkdir_p(path) unless File.exists?(path)

      @logger = ::Logger.new(File.join(path, 'twitter_friendly.log'))
      @logger.level = options[:log_level] || :debug
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter_friendly-2.0.1.pre.alpha lib/twitter_friendly/logger.rb
twitter_friendly-2.0.0.pre.alpha lib/twitter_friendly/logger.rb
twitter_friendly-1.2.3 lib/twitter_friendly/logger.rb
twitter_friendly-1.2.2 lib/twitter_friendly/logger.rb
twitter_friendly-1.2.1 lib/twitter_friendly/logger.rb