Sha256: 76c0e5d0de809a46d19c998d692304ff4ef7b8086a0c8df99b099c263c718891

Contents?: true

Size: 617 Bytes

Versions: 9

Compression:

Stored size: 617 Bytes

Contents

#!/usr/bin/env ruby
$:<< '../lib' << 'lib'

require 'goliath'

Goliath::Request.log_block = proc do |env, response, elapsed_time|
  method = env[Goliath::Request::REQUEST_METHOD]
  path = env[Goliath::Request::REQUEST_PATH]
  
  env[Goliath::Request::RACK_LOGGER].info("#{method} #{path} in #{'%.2f' % elapsed_time} ms")  
end

class SimpleAPI < Goliath::API
  def response(env)
    [200, {}, "It worked !"]
  end
end

# [19843:INFO] 2012-02-12 18:03:44 :: GET /some/url/ in 4.35 ms
# [19843:INFO] 2012-02-12 18:03:49 :: GET /another/url/ in 4.24 ms
# [19843:INFO] 2012-02-12 18:04:01 :: PUT /another/url/ in 4.16 ms

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
goliath-1.0.7 examples/custom_logs.rb
goliath-1.0.6 examples/custom_logs.rb
goliath-1.0.5 examples/custom_logs.rb
goliath-1.0.4 examples/custom_logs.rb
goliath-1.0.3 examples/custom_logs.rb
goliath-1.0.2 examples/custom_logs.rb
goliath-1.0.1 examples/custom_logs.rb
goliath-1.0.0 examples/custom_logs.rb
goliath-1.0.0.beta.1 examples/custom_logs.rb