Sha256: 3069a18f575a6e216af59971cda2af213190acdf80eedcf7c50a415cd7a8322b

Contents?: true

Size: 466 Bytes

Versions: 9

Compression:

Stored size: 466 Bytes

Contents

require "logger"

module Fume
  class SmartLogger
    def self.create(name, log_level = Logger::DEBUG)
      logger = case name
      when "STDOUT"
        Logger.new(STDOUT)
      when /(\w+)/
        Logger.new(Rails.root.join("log", "#{$1}.log"))
      when /(\w+\.\w+)/
        Logger.new(Rails.root.join("log", $1))
      else
        Logger.new(Rails.root.join("log", "#{Rails.env}.log"))
      end
      logger.level = log_level
      logger
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fume-0.5.3 lib/fume/smart_logger.rb
fume-0.5.2 lib/fume/smart_logger.rb
fume-0.5.1 lib/fume/smart_logger.rb
fume-0.5.0 lib/fume/smart_logger.rb
fume-0.4.3 lib/fume/smart_logger.rb
fume-0.4.2 lib/fume/smart_logger.rb
fume-0.4.1 lib/fume/smart_logger.rb
fume-0.4.0 lib/fume/smart_logger.rb
fume-0.3.5 lib/fume/smart_logger.rb