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 +4 -4
- data/lib/logeater/cli.rb +21 -7
- data/lib/logeater/reader.rb +2 -2
- data/lib/logeater/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baef36bfc637d3c838e597b0db6681507af6ddb8
|
4
|
+
data.tar.gz: d4e37a1dd74838f75d660b0068574218e7749ccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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
|
-
|
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 "
|
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
|
data/lib/logeater/reader.rb
CHANGED
@@ -136,8 +136,8 @@ module Logeater
|
|
136
136
|
|
137
137
|
def save!
|
138
138
|
return if completed_requests.empty?
|
139
|
-
|
140
|
-
@count +=
|
139
|
+
Logeater::Request.import(completed_requests)
|
140
|
+
@count += completed_requests.length
|
141
141
|
completed_requests.clear
|
142
142
|
end
|
143
143
|
|
data/lib/logeater/version.rb
CHANGED