log_error_handler 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73d834422224b75eca855fc6508be40a1f24aa3a
|
4
|
+
data.tar.gz: 4a8923b446f270bedd70471880379f2d61739338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 213d9847baf05db31d49a9f51a1fc13b4a43ef5a3794d910f2ecc804ee4f50c5fcbd55a9e97c41e7c5c0bab50973e37d6302011e92acc0904369828c637eb7c9
|
7
|
+
data.tar.gz: 16ea0f664c918e414f4a4e2e53dfa0232114c67d01d1bfd61d0489ffe282bdafd50713af90fc411f81fb1b9d52ed34cf64ebf4b9e2a7ce0fab03ded8144f8371
|
data/bin/log_error_handler
CHANGED
@@ -59,6 +59,10 @@ OptionParser.new do |opts|
|
|
59
59
|
options[:error_message_key] = key
|
60
60
|
end
|
61
61
|
|
62
|
+
opts.on('--debug_mode', 'Puts logs to standard stdout') do
|
63
|
+
options[:debug_mode] = true
|
64
|
+
end
|
65
|
+
|
62
66
|
opts.on('-d', '--daemonize', 'Daemonize') do
|
63
67
|
Process.daemon(true, true)
|
64
68
|
end
|
@@ -24,6 +24,7 @@ module LogErrorHandler
|
|
24
24
|
|
25
25
|
@tracker.mutex.lock
|
26
26
|
@tracker.tracking_logs.each do |key, value|
|
27
|
+
$stdout.puts "\n\nCheck file: #{key}. Status: #{value[:status]}\n\n" if @tracker.options[:debug_mode]
|
27
28
|
next if Time.now.to_i - value[:timestamp] <= @tracker.options[:not_modify_timeout]
|
28
29
|
if value[:status] == :error
|
29
30
|
value[:file].rewind
|
@@ -33,6 +33,7 @@ module LogErrorHandler
|
|
33
33
|
@tracker.mutex.unlock
|
34
34
|
|
35
35
|
text = line.sub(@tracker.options[:tid_regexp], '')
|
36
|
+
$stdout.puts "#{@last_tid}: #{text}" if @tracker.options[:debug_mode]
|
36
37
|
@tracker.tracking_logs[@last_tid][:file].write(text)
|
37
38
|
@tracker.tracking_logs[@last_tid][:status] = :error if text[@tracker.options[:error_regexp]]
|
38
39
|
@tracker.tracking_logs[@last_tid][:timestamp] = Time.now.to_i
|