Class: Aptible::CLI::TtyLogFormatter

Inherits:
Object
  • Object
show all
Includes:
Term::ANSIColor
Defined in:
lib/aptible/cli.rb

Instance Method Summary collapse

Instance Method Details

#call(severity, _, _, msg) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/aptible/cli.rb', line 29

def call(severity, _, _, msg)
  color = case severity
          when 'DEBUG'
            :no_color
          when 'INFO'
            :green
          when 'WARN'
            :yellow
          when 'ERROR', 'FATAL'
            :red
          else
            :no_color
          end

  "#{public_send(color, msg)}\n"
end

#no_color(msg) ⇒ Object



46
47
48
# File 'lib/aptible/cli.rb', line 46

def no_color(msg)
  msg
end