log_slice 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/log_slice_date +17 -0
  2. data/log_slice.gemspec +1 -1
  3. metadata +6 -5
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require 'date'
3
+ require File.expand_path("../lib/log_slice", File.dirname(__FILE__))
4
+ find_date = begin
5
+ DateTime.parse(ARGV[0])
6
+ rescue
7
+ $stderr.puts "USAGE: #{$0} DATE FILEPATH\n\n"
8
+ $stderr.puts "EXAMPLE: #{$0} '2012-08-31 12:00:00' /tmp/something.log\n\n"
9
+ $stderr.puts "Expects log lines to contain a DateTime string enclosed in [square brackets] \n\n"
10
+ $stderr.puts "Could not parse date argument\n\n"
11
+ raise
12
+ end
13
+ file = LogSlice.new(ARGV[1]).find do |line|
14
+ date_string = line.match(/\[([^\]]+)\]/)[1]
15
+ find_date <=> DateTime.parse(date_string)
16
+ end
17
+ puts file.readline until file.eof?
data/log_slice.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'log_slice'
3
- s.version = '0.2'
3
+ s.version = '0.3'
4
4
  s.authors = ["Joel Plane"]
5
5
  s.email = ["joel.plane@gmail.com"]
6
6
  s.homepage = 'https://github.com/joelplane/log_slice'
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_slice
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- version: "0.2"
8
+ - 3
9
+ version: "0.3"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joel Plane
@@ -33,8 +33,8 @@ dependencies:
33
33
  description: Find a line in a log file. Uses binary search to find the line quickly in a large log file. Can only search sorted data - which in the case of log file is the timestamp, and probably not much else.
34
34
  email:
35
35
  - joel.plane@gmail.com
36
- executables: []
37
-
36
+ executables:
37
+ - log_slice_date
38
38
  extensions: []
39
39
 
40
40
  extra_rdoc_files: []
@@ -43,6 +43,7 @@ files:
43
43
  - .gitignore
44
44
  - Gemfile
45
45
  - README.md
46
+ - bin/log_slice_date
46
47
  - lib/log_slice.rb
47
48
  - lib/log_slice/search_boundary.rb
48
49
  - log_slice.gemspec