Class: Rack::RackLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_rack_logger/rack_logger.rb

Direct Known Subclasses

ErrorLogger, RequestLogger

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, logger, *filters) ⇒ RackLogger

Returns a new instance of RackLogger.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simple_rack_logger/rack_logger.rb', line 7

def initialize(app, logger, *filters)
  @app     = app
  @logger  = logger
  @filters = filters

  def @logger.flush
    # Chamando o flush diretamente, pois está demorando para descarregar a memória
    # além de não ter a opção de executar
    logdev = self.instance_variable_get(:@logdev)
    logdev.instance_variable_get(:@dev).flush if logdev
  end
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



5
6
7
# File 'lib/simple_rack_logger/rack_logger.rb', line 5

def logger
  @logger
end

Class Method Details

.flushObject



12
13
14
15
16
17
# File 'lib/simple_rack_logger/rack_logger.rb', line 12

def @logger.flush
  # Chamando o flush diretamente, pois está demorando para descarregar a memória
  # além de não ter a opção de executar
  logdev = self.instance_variable_get(:@logdev)
  logdev.instance_variable_get(:@dev).flush if logdev
end