Class: LogFormatter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/zillabyte/cli/log_formatter.rb

Direct Known Subclasses

Operation, Startup

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Base

Returns a new instance of Base.



10
11
12
13
14
15
# File 'lib/zillabyte/cli/log_formatter.rb', line 10

def initialize
  @all_colors ||= COLORS.clone
  @color_map = {
    'app' => :white
  }
end

Instance Method Details



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/zillabyte/cli/log_formatter.rb', line 17

def print_log_line(hash)

  # Dno't show heartbeats
  return if hash['heartbeat']

  # Init 
  line = hash['line']
  category = hash['category']
  date = hash['date']
  name = hash['name']
  index = hash['index']
  
  # Don't display 'hidden' lines
  if category == 'hidden'
    
    handle_hidden(name, index, category, date, line);
    
  else
    
    # Print it out
    display(name, index, category, date, line)
    
  end
  

end