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



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aptible/cli.rb', line 15

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



32
33
34
# File 'lib/aptible/cli.rb', line 32

def no_color(msg)
  msg
end