Sha256: 90b96ad70f154961a525ef165ab55ad6c97ce80a1f02b904fe18e4d7d4312386

Contents?: true

Size: 591 Bytes

Versions: 47

Compression:

Stored size: 591 Bytes

Contents

require 'colored'
require 'r10k/logging'
require 'log4r/outputter/iooutputter'

module R10K
  module Logging
    class TerminalOutputter < Log4r::IOOutputter

      COLORS = [
        nil,
        :cyan,
        :cyan,
        :green,
        nil,
        nil,
        :yellow,
        :red,
        :red,
      ]

      attr_accessor :use_color

      private

      def format(logevent)
        string = super
        if @use_color
          color = COLORS[logevent.level]
          color ? string.send(color) : string
        else
          string
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
r10k-2.1.1 lib/r10k/logging/terminaloutputter.rb
r10k-2.1.0 lib/r10k/logging/terminaloutputter.rb
r10k-2.0.3 lib/r10k/logging/terminaloutputter.rb
r10k-2.0.2 lib/r10k/logging/terminaloutputter.rb
r10k-2.0.1 lib/r10k/logging/terminaloutputter.rb
r10k-2.0.0 lib/r10k/logging/terminaloutputter.rb
r10k-1.5.1 lib/r10k/logging/terminaloutputter.rb