Class: Log

Inherits:
Object
  • Object
show all
Defined in:
lib/log.rb

Instance Method Summary collapse

Constructor Details

#initializeLog

Returns a new instance of Log.



4
5
6
# File 'lib/log.rb', line 4

def initialize
  @p = Pastel.new
end

Instance Method Details

#cmd_success(label, value) ⇒ Object



8
9
10
# File 'lib/log.rb', line 8

def cmd_success(label, value)
  puts @p.green("#{label} #{@p.yellow(value)}")
end

#log_cmd(cmd) ⇒ Object



24
25
26
# File 'lib/log.rb', line 24

def log_cmd(cmd)
  puts @p.cyan("==> #{cmd}")
end

#log_data_error(data) ⇒ Object



34
35
36
37
38
# File 'lib/log.rb', line 34

def log_data_error(data)
  puts ''
  puts @p.red(data)
  puts ''
end

#log_data_success(data) ⇒ Object



28
29
30
31
32
# File 'lib/log.rb', line 28

def log_data_success(data)
  puts ''
  puts @p.green(data)
  puts ''
end

#log_key_value(key, value) ⇒ Object



12
13
14
# File 'lib/log.rb', line 12

def log_key_value(key, value)
  puts @p.green.bold("#{key}: #{@p.yellow(value)}")
end

#log_key_values(key, values) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/log.rb', line 16

def log_key_values(key, values)
  puts @p.green.bold(key)

  values.each_with_index do |value, index|
    puts "  #{@p.blue(index)} - #{@p.yellow(value)}"
  end
end