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.6.9 lib/r10k/logging/terminaloutputter.rb
r10k-2.6.8 lib/r10k/logging/terminaloutputter.rb
r10k-3.3.3 lib/r10k/logging/terminaloutputter.rb
r10k-3.2.3 lib/r10k/logging/terminaloutputter.rb
r10k-2.6.7 lib/r10k/logging/terminaloutputter.rb
r10k-3.3.2 lib/r10k/logging/terminaloutputter.rb
r10k-3.3.1 lib/r10k/logging/terminaloutputter.rb
r10k-3.2.1 lib/r10k/logging/terminaloutputter.rb
r10k-3.0.4 lib/r10k/logging/terminaloutputter.rb
r10k-2.6.6 lib/r10k/logging/terminaloutputter.rb
r10k-3.3.0 lib/r10k/logging/terminaloutputter.rb
r10k-3.2.0 lib/r10k/logging/terminaloutputter.rb
r10k-3.1.1 lib/r10k/logging/terminaloutputter.rb
r10k-3.1.0 lib/r10k/logging/terminaloutputter.rb
r10k-2.6.5 lib/r10k/logging/terminaloutputter.rb
r10k-3.0.3 lib/r10k/logging/terminaloutputter.rb
r10k-3.0.2 lib/r10k/logging/terminaloutputter.rb
r10k-3.0.1 lib/r10k/logging/terminaloutputter.rb
r10k-3.0.0 lib/r10k/logging/terminaloutputter.rb
r10k-2.6.4 lib/r10k/logging/terminaloutputter.rb