Sha256: d0c284f3224ab00498916834a995b0d4cf64356212725c21a66561c9355ee119
Contents?: true
Size: 621 Bytes
Versions: 1
Compression:
Stored size: 621 Bytes
Contents
#!/usr/bin/env ruby require 'date' require File.expand_path("../lib/log_slice", File.dirname(__FILE__)) find_date = begin DateTime.parse(ARGV[0]) rescue $stderr.puts "USAGE: #{$0} DATE FILEPATH\n\n" $stderr.puts "EXAMPLE: #{$0} '2012-08-31 12:00:00' /tmp/something.log\n\n" $stderr.puts "Expects log lines to contain a DateTime string enclosed in [square brackets] \n\n" $stderr.puts "Could not parse date argument\n\n" raise end file = LogSlice.new(ARGV[1]).find do |line| date_string = line.match(/\[([^\]]+)\]/)[1] find_date <=> DateTime.parse(date_string) end puts file.readline until file.eof?
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
log_slice-0.3 | bin/log_slice_date |