Class: BleakHouseDiagnostic

Inherits:
Object
  • Object
show all
Defined in:
lib/god/diagnostics.rb

Constant Summary collapse

LOG_FILE =
File.join(File.dirname(__FILE__), *%w[.. .. logs bleak.log])

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



16
17
18
# File 'lib/god/diagnostics.rb', line 16

def logger
  @logger
end

Class Method Details

.installObject



19
20
21
22
23
# File 'lib/god/diagnostics.rb', line 19

def self.install
  require 'bleak_house'
  self.logger = BleakHouse::Logger.new
  File.delete(LOG_FILE) rescue nil
end

.snapshot(name) ⇒ Object



25
26
27
# File 'lib/god/diagnostics.rb', line 25

def self.snapshot(name)
  self.logger.snapshot(LOG_FILE, name, false) if self.logger
end

.spin(delay = 1) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/god/diagnostics.rb', line 29

def self.spin(delay = 1)
  Thread.new do
    loop do
      self.snapshot
      sleep(delay)
    end
  end
end