logeater 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 678d8cc0af848644fd37cf1762d97a9d7779bd5a
4
- data.tar.gz: 0ac115076cd9daedc7b74d4f01dd04e2d63e56a6
3
+ metadata.gz: baef36bfc637d3c838e597b0db6681507af6ddb8
4
+ data.tar.gz: d4e37a1dd74838f75d660b0068574218e7749ccc
5
5
  SHA512:
6
- metadata.gz: e3d70df2e56453afba0d382252555801e17e8d7c2ec7d83da83dc147e91bc61f6fd8dc4127bfaadf9c2d71bcdce561cd8c09403a5cc83a129443031ed3ff1545
7
- data.tar.gz: 0085e7c733283ecb91ec507a5de05bb53bd2a2d1b4a63a23431cfb750505cd489e2425a63772da3f4f9cb92a274743551ac0a7c112cc0570d7f3c5813cc3272c
6
+ metadata.gz: 5f27a873c0aa0c056299578338aaf681506006be426b7edbfa0d60a73d5a0081d7bb38a7255574ceb4cc502d82e6148c7024c133afa5e9d9a3804a5aa918790b
7
+ data.tar.gz: 9f869c5523cbf043f562491a8d0da4d85f392516be853fa398dd22c69f2bce841583be673ec213b7136672e5d4fc9b6736400e019aeca13ef4b4803becf4fb60
data/lib/logeater/cli.rb CHANGED
@@ -39,8 +39,17 @@ module Logeater
39
39
  desc "import APP FILES", "imports files"
40
40
  def import(app, *files)
41
41
  unless options[:force]
42
+ started_at = Time.now
42
43
  imported_files = Logeater::Request.where(app: app).pluck("DISTINCT logfile")
43
- files.reject! { |file| imported_files.member? File.basename(files[0]) }
44
+ finished_at = Time.now
45
+
46
+ $stderr.puts " > \e[34mListed imported logfiles for \e[1m#{app}\e[0;34m in \e[1m%.2f\e[0;34m seconds\e[0m\n" % [
47
+ finished_at - started_at ]
48
+
49
+ files_count = files.count
50
+ files.reject! { |file| imported_files.member? File.basename(file) }
51
+
52
+ $stderr.puts " \e[34;1m#{files_count}\e[0;34m files passed, \e[1m#{files_count - files.length}\e[0;34m removed as already imported.\e[0m\n\n"
44
53
  end
45
54
 
46
55
  if files.empty?
@@ -50,22 +59,27 @@ module Logeater
50
59
 
51
60
  started_all = Time.now
52
61
  files.each_with_index do |file, i|
53
- $stderr.puts " > \e[34mImporting \e[1m#{File.basename(file)}\e[0;34m (%d of %d)\e[0m\n\n" % [
62
+ $stderr.puts " > \e[34mImporting \e[1m#{File.basename(file)}\e[0;34m (%d of %d)\e[0m\n" % [
54
63
  i + 1,
55
64
  files.length ]
56
65
 
57
66
  reader = Logeater::Reader.new(app, file, options.slice(:progress, :verbose))
58
- reader.remove_existing_entries!
67
+
68
+ started_at = Time.now
69
+ count = reader.remove_existing_entries!
70
+ finished_at = Time.now
71
+
72
+ $stderr.puts " \e[34mDeleted \e[1m%d\e[0;34m requests for #{file} in \e[1m%.2f\e[0;34m seconds\e[0m\n" % [
73
+ count,
74
+ finished_at - started_at ]
59
75
 
60
76
  started_at = Time.now
61
77
  count = reader.import
62
78
  finished_at = Time.now
63
79
 
64
- $stderr.puts " > \e[34mImported \e[1m%d\e[0;34m requests in \e[1m%.2f\e[0;34m seconds (%d of %d)\e[0m\n\n" % [
80
+ $stderr.puts " \e[34mImported \e[1m%d\e[0;34m requests in \e[1m%.2f\e[0;34m seconds\e[0m\n\n" % [
65
81
  count,
66
- finished_at - started_at,
67
- i + 1,
68
- files.length ]
82
+ finished_at - started_at ]
69
83
  end
70
84
 
71
85
  finished_all = Time.now
@@ -136,8 +136,8 @@ module Logeater
136
136
 
137
137
  def save!
138
138
  return if completed_requests.empty?
139
- result = Logeater::Request.import(completed_requests)
140
- @count += result.num_inserts
139
+ Logeater::Request.import(completed_requests)
140
+ @count += completed_requests.length
141
141
  completed_requests.clear
142
142
  end
143
143
 
@@ -1,3 +1,3 @@
1
1
  module Logeater
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logeater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail