Class: Rack::Insight::LogPanel::LogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/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.



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

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

Instance Attribute Details

#levelObject (readonly)

TODO: Update this to the Rack::Insight panel format



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

def level
  @level
end

#messageObject (readonly)

TODO: Update this to the Rack::Insight panel format



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

def message
  @message
end

#timeObject (readonly)

TODO: Update this to the Rack::Insight panel format



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

def time
  @time
end

Instance Method Details

#cleaned_messageObject



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

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