Sha256: 30b5ac3b685b1de8a984b20e24dff1d21aef4efac8bd71c067afa36e8be8711d

Contents?: true

Size: 559 Bytes

Versions: 34

Compression:

Stored size: 559 Bytes

Contents

require "rubygems"
require "sinatra"
$: << "./lib"
require "cabin"
require "logger"

$logger = Cabin::Channel.new
$logger.subscribe(Logger.new(STDOUT))

def serve_it_up(arg)
  $logger.info("Serving it up")
  sleep 2
  "Hello, #{arg}!"
end

get "/hello/:name" do
  context = $logger.context
  context[:name] = params[:name]
  context[:verb] = "GET"
  timer = $logger.time("serve_it_up latency")
  result = serve_it_up(params[:name])
  timer.stop

  # Clear the context so that the next request doesn't have tainted context.
  context.clear
  return result
end

Version data entries

34 entries across 32 versions & 6 rubygems

Version Path
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/cabin-0.8.1/examples/sinatra-logging.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/cabin-0.8.1/examples/sinatra-logging.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/cabin-0.8.1/examples/sinatra-logging.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/cabin-0.8.1/examples/sinatra-logging.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/cabin-0.8.1/examples/sinatra-logging.rb
cabin-0.9.0 examples/sinatra-logging.rb
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/cabin-0.7.1/examples/sinatra-logging.rb
cabin-0.8.1 examples/sinatra-logging.rb
cabin-0.8.0 examples/sinatra-logging.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/cabin-0.7.2/examples/sinatra-logging.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/cabin-0.7.1/examples/sinatra-logging.rb
logstash-input-beats-2.0.2 vendor/jruby/1.9/gems/logstash-codec-json-2.0.3/vendor/gems/cabin-0.7.2/examples/sinatra-logging.rb
logstash-codec-json-2.0.3 vendor/gems/cabin-0.7.2/examples/sinatra-logging.rb
cabin-0.7.2 examples/sinatra-logging.rb
logstash-input-beats-0.9.2 vendor/jruby/1.9/gems/cabin-0.7.1/examples/sinatra-logging.rb
logstash-input-beats-0.9.1 vendor/jruby/1.9/gems/cabin-0.7.1/examples/sinatra-logging.rb
cabin-0.7.1 examples/sinatra-logging.rb
cabin-0.6.1 examples/sinatra-logging.rb
cabin-0.6.0 examples/sinatra-logging.rb
cabin-0.5.0 examples/sinatra-logging.rb