Class: Rack::Bug::LogPanel

Inherits:
Panel
  • Object
show all
Defined in:
lib/rack/bug/panels/log_panel.rb

Instance Attribute Summary

Attributes inherited from Panel

#request

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Panel

#after, #before, #call, #has_content?, #initialize, #panel_app, #render

Methods included from Render

#compile, #compile!, #compiled_source, #method_name, #method_name_without_locals, #render_template, #signed_params

Constructor Details

This class inherits a constructor from Rack::Bug::Panel

Class Method Details

.logsObject



18
19
20
# File 'lib/rack/bug/panels/log_panel.rb', line 18

def self.logs
  Thread.current["rack.bug.logs"] ||= []
end

.record(message) ⇒ Object



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

def self.record(message)
  return unless Rack::Bug.enabled?
  return unless message
  logs << message.to_s
end

.resetObject



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

def self.reset
  Thread.current["rack.bug.logs"] = []
end

Instance Method Details

#contentObject



30
31
32
33
34
# File 'lib/rack/bug/panels/log_panel.rb', line 30

def content
  result = render_template "panels/log", :logs => self.class.logs
  self.class.reset
  return result
end

#headingObject



26
27
28
# File 'lib/rack/bug/panels/log_panel.rb', line 26

def heading
  "Log"
end

#nameObject



22
23
24
# File 'lib/rack/bug/panels/log_panel.rb', line 22

def name
  "log"
end