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.5.beta1 lib/miam/logger.rb
miam-0.2.4 lib/miam/logger.rb
miam-0.2.4.beta18 lib/miam/logger.rb
miam-0.2.4.beta17 lib/miam/logger.rb
miam-0.2.4.beta16 lib/miam/logger.rb
miam-0.2.4.beta15 lib/miam/logger.rb
miam-0.2.4.beta14 lib/miam/logger.rb
miam-0.2.4.beta13 lib/miam/logger.rb
miam-0.2.4.beta12 lib/miam/logger.rb
miam-0.2.4.beta11 lib/miam/logger.rb
miam-0.2.4.beta10 lib/miam/logger.rb
miam-0.2.4.beta9 lib/miam/logger.rb
miam-0.2.4.beta8 lib/miam/logger.rb
miam-0.2.4.beta7 lib/miam/logger.rb
miam-0.2.4.beta6 lib/miam/logger.rb
miam-0.2.4.beta5 lib/miam/logger.rb
miam-0.2.4.beta4 lib/miam/logger.rb
miam-0.2.4.beta3 lib/miam/logger.rb
miam-0.2.4.beta2 lib/miam/logger.rb
miam-0.2.4.beta lib/miam/logger.rb