Sha256: a5fba834afa1d00de1bcc52574410d7d5c85fc436798afae5b37406cbf074291

Contents?: true

Size: 541 Bytes

Versions: 1

Compression:

Stored size: 541 Bytes

Contents

# encoding: UTF-8
require 'rubygems'
require 'logger'

module LogMe
  attr_writer :log_enabled
  attr_writer :log_level
  attr_writer :logger

  def log_enabled?
    @log_enabled != false
  end

  def log_level
    @log_level ||= :info
  end

  def logger
    @logger ||= ::Logger.new STDOUT
  end

  def log(message)
    logger.send log_level, message if log_enabled?
  end

  def self.extended(base)
    base.send :extend, Configuration
  end

  module Configuration
    def configure_me
      yield self if block_given?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
log-me-0.0.0 lib/log-me.rb