Sha256: fb1e204a28f2c62538c9337b3e6dc40fbb72d6df29bb2f9e782eae7536eff7ba

Contents?: true

Size: 671 Bytes

Versions: 40

Compression:

Stored size: 671 Bytes

Contents

class Miam::Logger < ::Logger
  include Singleton

  def initialize
    super($stdout)

    self.formatter = proc do |severity, datetime, progname, msg|
      "#{msg}\n"
    end

    self.level = Logger::INFO
  end

  def set_debug(value)
    self.level = value ? Logger::DEBUG : Logger::INFO
  end

  module Helper
    def log(level, message, log_options = {})
      message = "[#{level.to_s.upcase}] #{message}" unless level == :info
      message << ' (dry-run)' if @options[:dry_run]
      message = message.send(log_options[:color]) if log_options[:color]
      logger = @options[:logger] || Miam::Logger.instance
      logger.send(level, message)
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
miam-0.2.3 lib/miam/logger.rb
miam-0.2.3.beta3 lib/miam/logger.rb
miam-0.2.3.beta2 lib/miam/logger.rb
miam-0.2.3.beta lib/miam/logger.rb
miam-0.2.2 lib/miam/logger.rb
miam-0.2.2.beta4 lib/miam/logger.rb
miam-0.2.2.beta3 lib/miam/logger.rb
miam-0.2.2.beta2 lib/miam/logger.rb
miam-0.2.2.beta lib/miam/logger.rb
miam-0.2.1 lib/miam/logger.rb
miam-0.2.1.beta2 lib/miam/logger.rb
miam-0.2.1.beta lib/miam/logger.rb
miam-0.2.0 lib/miam/logger.rb
miam-0.2.0.beta3 lib/miam/logger.rb
miam-0.2.0.beta2 lib/miam/logger.rb
miam-0.2.0.beta lib/miam/logger.rb
miam-0.1.4 lib/miam/logger.rb
miam-0.1.3 lib/miam/logger.rb
miam-0.1.2 lib/miam/logger.rb
miam-0.1.1 lib/miam/logger.rb