Sha256: 7fb7b88dfd81b23af0949341263c4b351d9b3044ad2d481d57d1c658b45db1cc

Contents?: true

Size: 771 Bytes

Versions: 15

Compression:

Stored size: 771 Bytes

Contents

module Dyna
  class 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 ClientHelper
      def log(level, message, color, log_id = nil)
        message = "[#{level.to_s.upcase}] #{message}" unless level == :info
        message << ": #{log_id}" if log_id
        message << ' (dry-run)' if @options && @options.dry_run
        logger = (@options && @options.logger) || Dyna::Logger.instance
        message = message.send(color) if color
        logger.send(level, message)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dyna-0.2.3 lib/dyna/logger.rb
dyna-0.2.2 lib/dyna/logger.rb
dyna-0.2.1 lib/dyna/logger.rb
dyna-0.2.1.beta2 lib/dyna/logger.rb
dyna-0.2.1.beta1 lib/dyna/logger.rb
dyna-0.2.0 lib/dyna/logger.rb
dyna-0.1.9 lib/dyna/logger.rb
dyna-0.1.8 lib/dyna/logger.rb
dyna-0.1.7 lib/dyna/logger.rb
dyna-0.1.6 lib/dyna/logger.rb
dyna-0.1.5 lib/dyna/logger.rb
dyna-0.1.4 lib/dyna/logger.rb
dyna-0.1.3 lib/dyna/logger.rb
dyna-0.1.2 lib/dyna/logger.rb
dyna-0.1.1 lib/dyna/logger.rb