README.md in apache_log-parser-2.0.2 vs README.md in apache_log-parser-3.0.0

- old
+ new

@@ -1,41 +1,34 @@ -# ApacheLog::Parser -[![Build Status](https://travis-ci.org/takady/apache_log-parser.svg?branch=master)](https://travis-ci.org/takady/apache_log-parser) [![Code Climate](https://codeclimate.com/github/takady/apache_log-parser/badges/gpa.svg)](https://codeclimate.com/github/takady/apache_log-parser) -Gem to parse apache log including common, combined and customized format. +# ApacheLog::Parser [![Build Status](https://travis-ci.org/takady/apache_log-parser.svg?branch=master)](https://travis-ci.org/takady/apache_log-parser) [![Code Climate](https://codeclimate.com/github/takady/apache_log-parser/badges/gpa.svg)](https://codeclimate.com/github/takady/apache_log-parser) +Parse apache log including common, combined and customized format + ## Installation -Add this line to your application's Gemfile: - - gem 'apache_log-parser' - -And then execute: - - $ bundle - -Or install it yourself as: - $ gem install apache_log-parser ## Usage ```ruby require 'apache_log/parser' # common format -common_log = ApacheLog::Parser.parse(log_line, 'common') +parser = ApacheLog::Parser.new('common') +common_log = parser.parse(log_line) common_log[:remote_host] #=> remote host common_log[:datetime] #=> datetime common_log[:request] #=> request # combined format -combined_log = ApacheLog::Parser.parse(log_line, 'combined') +parser = ApacheLog::Parser.new('combined') +combined_log = parser.parse(log_line) combined_log[:referer] #=> referer combined_log[:user_agent] #=> user_agent # custom format(additional fields after 'combined') # e.g. "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%v\" \"%{cookie}n\" %D" -custom_log = ApacheLog::Parser.parse(log_line, 'combined', %w(vhost usertrack request_duration)) +parser = ApacheLog::Parser.new('combined', %w(vhost usertrack request_duration)) +custom_log = parser.parse(log_line) custom_log[:user_agent] #=> user_agent custom_log[:vhost] #=> vhost custom_log[:usertrack] #=> usertrack custom_log[:request_duration] #=> request_duration ```