Class: Crystal::Processors::HTTPLogger

Inherits:
Crystal::Processor show all
Defined in:
lib/crystal/http/processors/http_logger.rb

Instance Attribute Summary

Attributes inherited from Crystal::Processor

#next_processor

Instance Method Summary collapse

Methods inherited from Crystal::Processor

#initialize, inspect

Constructor Details

This class inherits a constructor from Crystal::Processor

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
# File 'lib/crystal/http/processors/http_logger.rb', line 4

def call
  if workspace.request? and workspace.params?        
    method, path, ip, time, format = workspace.request.request_method, workspace.path, 
      workspace.request.ip, (workspace.start_time || Time.now), workspace.params.format
    logger.info "Started '#{path}' as '#{format}' (for #{ip} at #{time.to_s} with #{method})"
  end
  
  next_processor.call
end