<commit_before># Mongoid Traffic

[![Build Status](https://travis-ci.org/tomasc/mongoid_traffic.svg)](https://travis-ci.org/tomasc/mongoid_traffic) [![Gem Version](https://badge.fury.io/rb/mongoid_traffic.svg)](http://badge.fury.io/rb/mongoid_traffic) [![Coverage Status](https://img.shields.io/coveralls/tomasc/mongoid_traffic.svg)](https://coveralls.io/r/tomasc/mongoid_traffic)

Aggregated traffic logs stored in MongoDB. Based on the approach described by <NAME> [here](http://www.railstips.org/blog/archives/2011/06/28/counters-everywhere/) and [here](http://www.railstips.org/blog/archives/2011/07/31/counters-everywhere-part-2/).

## Installation

Add this line to your application's Gemfile:

	gem 'mongoid_traffic'

And then execute:

	$ bundle

Or install it yourself as:

	$ gem install mongoid_traffic

## Usage

Create your a Log class:

	class MyLogger < Mongoid::TrafficLogger
	end

Log traffic like this:

	MyLogger.log

This will create/update the following records in the db:

	MongoidTraffic::Log y: 2014, m: 8, d: nil
	MongoidTraffic::Log y: 2014, m: 8, d: 13

## User Agent

Optionally, you can pass 'User-Agent' header string to the logger:

	MyLogger.log(user_agent: user_agent_string)

## Referer

Optionally, you can pass 'User-Agent' header string to the logger:

	MyLogger.log(referer: http_referer_string)

## Rails

## Contributing

1. Fork it ( https://github.com/tomasc/mongoid_traffic/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request<commit_msg>update doc<commit_after># Mongoid Traffic

[![Build Status](https://travis-ci.org/tomasc/mongoid_traffic.svg)](https://travis-ci.org/tomasc/mongoid_traffic) [![Gem Version](https://badge.fury.io/rb/mongoid_traffic.svg)](http://badge.fury.io/rb/mongoid_traffic) [![Coverage Status](https://img.shields.io/coveralls/tomasc/mongoid_traffic.svg)](https://coveralls.io/r/tomasc/mongoid_traffic)

Aggregated traffic logs stored in MongoDB. Based on the approach described by <NAME> [here](http://www.railstips.org/blog/archives/2011/06/28/counters-everywhere/) and [here](http://www.railstips.org/blog/archives/2011/07/31/counters-everywhere-part-2/).

## Installation

Add this line to your application's Gemfile:

	gem 'mongoid_traffic'

And then execute:

	$ bundle

Or install it yourself as:

	$ gem install mongoid_traffic

## Usage

Create your a Log class:

	class MyLogger < Mongoid::TrafficLogger
	end

Log traffic like this:

	MyLogger.log

This will create/update the following Mongoid records:

	MongoidTraffic::Log y(year): 2014, m(month): 8, d(day): nil
	MongoidTraffic::Log y(year): 2014, m(month): 8, d(day): 13

## User Agent

Optionally, you can pass 'User-Agent' header string to the logger:

	MyLogger.log(user_agent: user_agent_string)

## Referer

Optionally, you can pass 'User-Agent' header string to the logger:

	MyLogger.log(referer: http_referer_string)

## Rails

## Contributing

1. Fork it ( https://github.com/tomasc/mongoid_traffic/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
{'fraction_non_alphanumeric': 0.13052631578947368, 'fraction_numerical': 0.020451127819548873, 'mean_word_length': 4.774305555555555, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1807361', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1144, 'n_words': 302}