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 CHANGED
@@ -1,3 +1,6 @@
1
+ v0.5.1
2
+ Fixes minor issues with logging statements sent to console
3
+
1
4
  v0.5.0
2
5
  Supports new base logworm gem, which can work as a Heroku addon
3
6
  Configuration parameters now stored as URL
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('logworm_client', '0.5.0') do |p|
2
+ Echoe.new('logworm_client', '0.5.1') do |p|
3
3
  p.description = "logworm client utilities"
4
4
  p.url = "http://www.logworm.com"
5
5
  p.author = "Pomelo, LLC"
@@ -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
- $stderr.puts "Logworm not configured. #{$to_send} entries dropped." and return 0 unless LW_SERVER
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)
@@ -10,7 +10,7 @@ module Logworm
10
10
  end
11
11
 
12
12
  def call(env)
13
- return @app.call(env) unless env['RACK_ENV'] == 'production'
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
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{logworm_client}
5
- s.version = "0.5.0"
5
+ s.version = "0.5.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pomelo, LLC"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pomelo, LLC