Class: SCGI::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/style/handler/scgi.rb

Direct Known Subclasses

RailsSCGIProcessor

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings = {}) ⇒ Processor

Use the standard error as the output logger, and use $STYLE_SOCKET as the socket on which to listen



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/style/handler/scgi.rb', line 7

def initialize(settings = {})
  @socket ||= $STYLE_SOCKET
  @total_conns ||= 0
  @shutdown ||= false
  @dead ||= false
  @threads ||= Queue.new
  @log = Object.new
  def @log.info(msg)
    STDERR.puts("[INF][#{@pid ||= Process.pid}] #{msg}")
  end
  def @log.error(msg, exc=nil)
    STDERR.puts("[ERR][#{@pid ||= Process.pid}] #{msg}#{": #{exc}\n#{exc.backtrace.join("\n")}" if exc}")
  end
  @maxconns ||= settings[:maxconns] || 2**30-1
  super()
  setup_signals
end

Class Method Details

.error(msg, exc = nil) ⇒ Object



17
18
19
# File 'lib/style/handler/scgi.rb', line 17

def @log.error(msg, exc=nil)
  STDERR.puts("[ERR][#{@pid ||= Process.pid}] #{msg}#{": #{exc}\n#{exc.backtrace.join("\n")}" if exc}")
end

.info(msg) ⇒ Object



14
15
16
# File 'lib/style/handler/scgi.rb', line 14

def @log.info(msg)
  STDERR.puts("[INF][#{@pid ||= Process.pid}] #{msg}")
end