Class: Insight::LogPanel::LogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/insight/panels/log_panel.rb

Constant Summary collapse

LEVELS =
['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level, time, message) ⇒ LogEntry

Returns a new instance of LogEntry.



7
8
9
10
11
# File 'lib/insight/panels/log_panel.rb', line 7

def initialize(level, time, message)
  @level = LEVELS[level]
  @time = time
  @message = message
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



4
5
6
# File 'lib/insight/panels/log_panel.rb', line 4

def level
  @level
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/insight/panels/log_panel.rb', line 4

def message
  @message
end

#timeObject (readonly)

Returns the value of attribute time.



4
5
6
# File 'lib/insight/panels/log_panel.rb', line 4

def time
  @time
end

Instance Method Details

#cleaned_messageObject



13
14
15
# File 'lib/insight/panels/log_panel.rb', line 13

def cleaned_message
  @message.to_s.gsub(/\e\[[;\d]+m/, "")
end