<commit_before># Mysql2QueryFilter::Plugin::CasualLog

Plug-in that colorize the bad query for [Mysql2QueryFilter](https://github.com/winebarrel/mysql2_query_filter).

Porting of [MySQLCasualLog.pm](https://gist.github.com/kamipo/839e8a5b6d12bddba539).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'mysql2_query_filter-plugin-casual_log'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mysql2_query_filter-plugin-casual_log

## Usage

```ruby
require 'mysql2_query_filter'

Mysql2QueryFilter.configure do |filter|
  filter.plugin :casual_log , database: 'mysql'
end

Mysql2QueryFilter.enable

client = Mysql2::Client.new(host: 'localhost', username: 'root', database: 'mysql')
client.query('SELECT * FROM user')
# => # SELECT * FROM user
#    ---
#               id: 1
#      select_type: SIMPLE
#            table: user
#             type: ALL # <- red/bold
#    possible_keys:
#              key:
#          key_len:
#              ref:
#             rows: 4
#            Extra:
```

## Retated links

* http://kamipo.github.io/talks/20140711-mysqlcasual6<commit_msg>Fix README<commit_after># Mysql2QueryFilter::Plugin::CasualLog

Plug-in that colorize the bad query for [Mysql2QueryFilter](https://github.com/winebarrel/mysql2_query_filter).

Porting of [MySQLCasualLog.pm](https://gist.github.com/kamipo/839e8a5b6d12bddba539).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'mysql2_query_filter-plugin-casual_log'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mysql2_query_filter-plugin-casual_log

## Usage

```ruby
require 'mysql2_query_filter'

Mysql2QueryFilter.configure do |filter|
  filter.plugin :casual_log , database: 'mysql'
end

Mysql2QueryFilter.enable

client = Mysql2::Client.new(host: 'localhost', username: 'root', database: 'mysql')
client.query('SELECT * FROM user')
# => # SELECT * FROM user
#    ---
#               id: 1
#      select_type: SIMPLE
#            table: user
#             type: ALL # <- red/bold
#    possible_keys:
#              key:
#          key_len:
#              ref:
#             rows: 4
#            Extra:
```

![](http://i.gyazo.com/66a769f30eab5ff56655977d42a30f4d.png)

## Retated links

* http://kamipo.github.io/talks/20140711-mysqlcasual6
{'fraction_non_alphanumeric': 0.12526812526812528, 'fraction_numerical': 0.035607035607035604, 'mean_word_length': 3.1347517730496453, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, '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': '694638', 'n_tokens_mistral': 881, 'n_tokens_neox': 808, 'n_words': 163}