Class: Insight::LogPanel

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

Defined Under Namespace

Classes: LogEntry

Instance Attribute Summary

Attributes inherited from Panel

#request

Instance Method Summary collapse

Methods inherited from Panel

#after, #before, #call, current_panel_file, excluded, file_index, from_file, #has_content?, #heading_for_request, inherited, #panel_app, panel_exclusion, panel_mappings, #render

Methods included from Instrumentation::Client

#before_detect, #probe, #request_finish, #request_start

Methods included from Logging

logger

Methods included from Database::RequestDataClient

#key_sql_template, #retrieve, #store, #table_length, #table_setup

Methods included from Render

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

Constructor Details

#initialize(app) ⇒ LogPanel

Returns a new instance of LogPanel.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/insight/panels/log_panel.rb', line 24

def initialize(app)
  probe(self) do
    instrument "ActiveSupport::BufferedLogger" do
      instance_probe :add
    end

    instrument "Logger" do
      instance_probe :add
    end
  end

  table_setup("log_entries")

  super
end

Instance Method Details

#after_detect(method_call, timing, args, message) ⇒ Object



18
19
20
21
22
# File 'lib/insight/panels/log_panel.rb', line 18

def after_detect(method_call, timing, args, message)
  message = args[1] || args[2] unless message.is_a?(String)
  log_level = args[0]
  store(@env, LogEntry.new(log_level, timing.delta_t, message))
end

#content_for_request(number) ⇒ Object



48
49
50
# File 'lib/insight/panels/log_panel.rb', line 48

def content_for_request(number)
  render_template "panels/log", :logs => retrieve(number)
end

#headingObject



44
45
46
# File 'lib/insight/panels/log_panel.rb', line 44

def heading
  "Log"
end

#nameObject



40
41
42
# File 'lib/insight/panels/log_panel.rb', line 40

def name
  "log"
end