README.md in salestation-0.1.0 vs README.md in salestation-0.1.1
- old
+ new
@@ -71,9 +71,35 @@
include Salestation::Web.new(errors: {
CustomError => -> (error) { CustomResponse.new(error) }
})
```
+### Using a logger
+
+Salestation provides a rack logging middleware which can be used to log structured objects.
+
+```ruby
+class Webapp < Sinatra::Base
+ # ...
+ use Salestation::Web::RequestLogger, my_logger
+end
+```
+
+### Using StatsD
+
+Salestation provides a StatsD middleware which can be used record request
+execution time. A `timing` call with elapsed seconds is made to the provided
+StatsD instance with `path`, `method`, `status` tags.
+
+```ruby
+class Webapp < Sinatra::Base
+ # ...
+ use Salestation::Web::StatsdMiddleware,
+ Statsd.new(host, port),
+ metric: 'my-metric'
+end
+```
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).