Sha256: 71a823cbff9cf574ea22e5802f4ae1815362e0864c7ba0d65ec3c50a0be727d5

Contents?: true

Size: 730 Bytes

Versions: 68

Compression:

Stored size: 730 Bytes

Contents

require "logger"

$stdout.sync = true

module Smartcloud
	module Logger
	  def logger
	    @logger ||= Smartcloud::Logger.logger_for(self.class.name)
	  end

	  # Use a hash class-ivar to cache a unique Logger per class:
	  @loggers = {}

	  def self.included(base)
		class << base
			def logger
			  @logger ||= Smartcloud::Logger.logger_for(self.name)
			end
		end
	  end

	  class << self
	    def logger_for(classname)
	      @loggers[classname] ||= configure_logger_for(classname)
	    end

	    def configure_logger_for(classname)
	      logger = ::Logger.new($stdout)
		  logger.level = ::Logger.const_get("#{Smartcloud.config.logger_level}".upcase)
	      logger.progname = classname
	      logger
	    end
	  end
	end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
smartcloud-0.6.0 lib/smartcloud/logger.rb
smartcloud-0.5.3 lib/smartcloud/logger.rb
smartcloud-0.5.2 lib/smartcloud/logger.rb
smartcloud-0.5.1 lib/smartcloud/logger.rb
smartcloud-0.5.0 lib/smartcloud/logger.rb
smartcloud-0.4.4 lib/smartcloud/logger.rb
smartcloud-0.4.3 lib/smartcloud/logger.rb
smartcloud-0.4.2 lib/smartcloud/logger.rb
smartcloud-0.4.1 lib/smartcloud/logger.rb
smartcloud-0.3.2 lib/smartcloud/logger.rb
smartcloud-0.3.1 lib/smartcloud/logger.rb
smartcloud-0.3.0 lib/smartcloud/logger.rb
smartcloud-0.2.4 lib/smartcloud/logger.rb
smartcloud-0.2.3 lib/smartcloud/logger.rb
smartcloud-0.2.2 lib/smartcloud/logger.rb
smartcloud-0.2.1 lib/smartcloud/logger.rb
smartcloud-0.2.0 lib/smartcloud/logger.rb
smartcloud-0.2.0.beta2 lib/smartcloud/logger.rb
smartcloud-0.2.0.beta1 lib/smartcloud/logger.rb
smartcloud-0.1.0 lib/smartcloud/logger.rb