ruby_log_parser.rb --help
Example
andrew:~$ ruby rails_log_parser.rb --sort median < log/development.log
+----------------------+-------+------------+------+------+------+--------+
| Uri | Calls | Total Time | Max | Min | Avg | Median |
+----------------------+-------+------------+------+------+------+--------+
| TestController#index | 7 | 9316 | 1748 | 1053 | 1330 | 1221 |
| TestController#show | 1 | 764 | 764 | 764 | 764 | 764 |
+----------------------+-------+------------+------+------+------+--------+
The code
You can find the parser here:
http://github.com/andrewtimberlake/scripts/tree/master/rails/utils/rails_log_parser.rb
I have also stripped out the table pretty printing here:
http://gist.github.com/41938
Usage:
require 'tabalize_array'
arr = [
['John', 18],
['Jack', 21],
['Mary', 22],
['Jane', 24]
]
arr.tabalize(['Name', 'Age'], [:left, :right], STDOUT)
Comments
Have your say