logworm_client 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/lib/logworm_client/logger.rb +5 -1
- data/lib/logworm_client/rack.rb +2 -2
- data/lib/logworm_client/rails.rb +1 -1
- data/logworm_client.gemspec +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -35,7 +35,11 @@ module Logworm
|
|
35
35
|
def self.flush
|
36
36
|
to_send = $lr_queue.size
|
37
37
|
return 0 if to_send == 0
|
38
|
-
|
38
|
+
unless LW_SERVER
|
39
|
+
$stderr.puts "\t logworm not configured. #{to_send} entries dropped."
|
40
|
+
$lr_queue = []
|
41
|
+
return 0
|
42
|
+
end
|
39
43
|
|
40
44
|
begin
|
41
45
|
LW_SERVER.batch_log($lr_queue.to_json)
|
data/lib/logworm_client/rack.rb
CHANGED
@@ -10,7 +10,7 @@ module Logworm
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def call(env)
|
13
|
-
return @app.call(env) unless
|
13
|
+
return @app.call(env) unless ENV['RACK_ENV'] == 'production'
|
14
14
|
|
15
15
|
startTime = Time.now
|
16
16
|
Logger.start_cycle
|
@@ -29,7 +29,7 @@ module Logworm
|
|
29
29
|
Timeout::timeout(1) {
|
30
30
|
sent = 0
|
31
31
|
ts = Benchmark.realtime {sent = Logger.flush} # Flushes only if there are any entries. Times out after a second
|
32
|
-
env['rack.errors'].puts("\t *** logworm - logs sent in #{ts} seconds") if sent
|
32
|
+
env['rack.errors'].puts("\t *** logworm - logs sent in #{ts} seconds") if sent > 0
|
33
33
|
}
|
34
34
|
rescue Exception => e
|
35
35
|
# Ignore --nothing we can do
|
data/lib/logworm_client/rails.rb
CHANGED
@@ -51,7 +51,7 @@ if defined?(ActionController)
|
|
51
51
|
Timeout::timeout(1) {
|
52
52
|
sent = 0
|
53
53
|
ts = Benchmark.realtime {sent = Logworm::Logger.flush} # Flushes only if there are any entries. Times out after a second
|
54
|
-
logger.info("\t *** logworm - logs sent in #{ts} seconds") if sent
|
54
|
+
logger.info("\t *** logworm - logs sent in #{ts} seconds") if sent > 0
|
55
55
|
}
|
56
56
|
rescue Exception => e
|
57
57
|
# Ignore --nothing we can do
|
data/logworm_client.gemspec
CHANGED