Sha256: 2cbc123792b1d6323a095b3ff5e3056e52ca9bb8ed4227ca663fdfa9a6b5c26a

Contents?: true

Size: 668 Bytes

Versions: 12

Compression:

Stored size: 668 Bytes

Contents

class Barkdog::Logger < ::Logger
  include Singleton

  def initialize
    super($stdout)

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

    self.level = INFO
  end

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

  module Helper
    def log(level, message, opts = {})
      opts = (@options || {}).merge(opts)

      message = "[#{level.to_s.upcase}] #{message}" unless level == :info
      message << ' (dry-run)' if opts[:dry_run]
      message = message.send(opts[:color]) if opts[:color]

      logger = opts[:logger] || Barkdog::Logger.instance
      logger.send(level, message)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
barkdog-0.1.9 lib/barkdog/logger.rb
barkdog-0.1.8 lib/barkdog/logger.rb
barkdog-0.1.7 lib/barkdog/logger.rb
barkdog-0.1.6 lib/barkdog/logger.rb
barkdog-0.1.5 lib/barkdog/logger.rb
barkdog-0.1.4 lib/barkdog/logger.rb
barkdog-0.1.3 lib/barkdog/logger.rb
barkdog-0.1.3.beta lib/barkdog/logger.rb
barkdog-0.1.2 lib/barkdog/logger.rb
barkdog-0.1.1 lib/barkdog/logger.rb
barkdog-0.1.0 lib/barkdog/logger.rb
barkdog-0.0.1 lib/barkdog/logger.rb