Class: Sinatra::Syslog

Inherits:
Rack::CommonLogger
  • Object
show all
Defined in:
lib/sinatra-syslog.rb,
lib/sinatra/syslog/logger.rb

Defined Under Namespace

Classes: Logger

Instance Method Summary collapse

Constructor Details

#initialize(app, ident) ⇒ Syslog

Returns a new instance of Syslog.



6
7
8
# File 'lib/sinatra-syslog.rb', line 6

def initialize app, ident
  @app, @logger = app, Logger.new(ident)
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/sinatra-syslog.rb', line 10

def call env
  env['rack.logger'] = @logger
  env['rack.errors'] = @logger
  env['sinatra.commonlogger'] = true
  status, headers, body = super
  [status, headers, body]
ensure
  body.close if body.respond_to? :close
end