Module: Rack::Timeout::Logger

Extended by:
Logger
Included in:
Logger
Defined in:
lib/rack/timeout/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#deviceObject

Returns the value of attribute device.



7
8
9
# File 'lib/rack/timeout/logger.rb', line 7

def device
  @device
end

#levelObject

Returns the value of attribute level.



7
8
9
# File 'lib/rack/timeout/logger.rb', line 7

def level
  @level
end

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/rack/timeout/logger.rb', line 7

def logger
  @logger
end

Instance Method Details

#disableObject



27
28
29
30
# File 'lib/rack/timeout/logger.rb', line 27

def disable
  @observer, @logger, @level, @device, @inited = nil
  ::Rack::Timeout.unregister_state_change_observer(:logger)
end

#initObject



21
22
23
24
25
# File 'lib/rack/timeout/logger.rb', line 21

def init
  @observer = ::Rack::Timeout::StateChangeLoggingObserver.new
  ::Rack::Timeout.register_state_change_observer(:logger, &@observer.callback)
  @inited = true
end

#update(new_device, new_level) ⇒ Object



32
33
34
35
36
37
# File 'lib/rack/timeout/logger.rb', line 32

def update(new_device, new_level)
  init unless @inited
  @device     = new_device || $stderr
  @level      = new_level  || ::Logger::INFO
  self.logger = ::Rack::Timeout::StateChangeLoggingObserver.mk_logger(device, level)
end