README.md in sniffer-0.1.0 vs README.md in sniffer-0.2.0
- old
+ new
@@ -1,7 +1,8 @@
-# Sniffer [![Build Status](https://travis-ci.org/aderyabin/sniffer.svg?branch=master)](https://travis-ci.org/aderyabin/sniffer) [![Gem Version](https://badge.fury.io/rb/sniffer.svg)](https://rubygems.org/gems/sniffer) [![Maintainability](https://api.codeclimate.com/v1/badges/640cb17b3d748a49653f/maintainability)](https://codeclimate.com/github/aderyabin/sniffer/maintainability)
+# Sniffer
+[![Build Status](https://travis-ci.org/aderyabin/sniffer.svg?branch=master)](https://travis-ci.org/aderyabin/sniffer) [![Gem Version](https://badge.fury.io/rb/sniffer.svg)](https://rubygems.org/gems/sniffer) [![Join the chat at https://gitter.im/aderyabin/sniffer](https://badges.gitter.im/aderyabin/sniffer.svg)](https://gitter.im/aderyabin/sniffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Sniffer aims to help:
* Log outgoing HTTP requests. Sniffer logs as JSON format for export to ELK, Logentries and etc.
* Debug requests. Sniffer allows to save all requests/responses in storage for future debugging
@@ -13,10 +14,12 @@
* [HTTPClient](https://github.com/nahi/httpclient)
* [Patron](https://github.com/toland/patron)
* [Curb](https://github.com/taf2/curb/)
* [Ethon](https://github.com/typhoeus/ethon)
* [Typhoeus](https://github.com/typhoeus/typhoeus)
+* [EM-HTTP-Request](https://github.com/igrigorik/em-http-request)
+* [Excon](https://github.com/excon/excon)
<a href="https://evilmartians.com/">
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
@@ -43,26 +46,26 @@
## Configuration
Sniffer default options:
```ruby
-Sniffer.config do
- logger: Logger.new($stdout),
- severity: Logger::Severity::DEBUG,
+Sniffer.config do |c|
+ c.logger = Logger.new($stdout),
+ c.severity = Logger::Severity::DEBUG,
# HTTP options to log
- log: {
+ c.log = {
request_url: true,
request_headers: true,
request_body: true,
request_method: true,
response_status: true,
response_headers: true,
response_body: true,
timing: true
},
- store: true, # save requests/responses to Sniffer.data
- enabled: false # Sniffer disabled by default
+ c.store = true, # save requests/responses to Sniffer.data
+ c.enabled = false # Sniffer disabled by default
end
```
## Usage
@@ -106,10 +109,22 @@
```
Sniffer.clear!
```
+You can configure capacity of storage to prevent the huge memory usage and set up log rotation.
+By default log rotation is active (when capacity is set) and log works like a queue.
+If rotation is disabled - requests will be logged until result log size reaches the capacity.
+
+```
+# will fill the storage and stop logging
+Sniffer.config.store = {capacity: 1000, rotate: false}
+
+# will rotate logs to fit 1000 results (rotate is true by default)
+Sniffer.config.store = {capacity: 1000}
+```
+
You can reset config to default
```
Sniffer.reset!
```
@@ -136,9 +151,16 @@
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).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/aderyabin/sniffer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
+
+## Acknowledge
+
+* [Sergey Ponomarev](https://github.com/sponomarev)
+* [Salahutdinov Dmitry](https://github.com/dsalahutdinov)
+* [Stanislav Chereshkevich](https://github.com/dissident)
+* [Anatoliy Kurichev](https://github.com/russo-matrosso)
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).