logworm_amqp 0.8.3 → 0.8.4

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.8.4
2
+ No longer prints out amqp information when logging and should also self check for amqp url updates incase it was changed.
3
+
1
4
  v0.8.3
2
5
  Minor Fix
3
6
 
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('logworm_amqp', '0.8.3') do |p|
2
+ Echoe.new('logworm_amqp', '0.8.4') do |p|
3
3
  p.description = "logworm logging tool"
4
4
  p.url = "http://www.logworm.com"
5
5
  p.author = "Pomelo, LLC"
data/lib/base/db.rb CHANGED
@@ -5,6 +5,10 @@ require 'hmac-sha1'
5
5
  require 'cgi'
6
6
  require 'base64'
7
7
 
8
+ include Minion
9
+ logger do |msg|
10
+ end
11
+
8
12
  module Logworm
9
13
  class ForbiddenAccessException < Exception ; end
10
14
  class DatabaseException < Exception ; end
@@ -16,13 +20,18 @@ module Logworm
16
20
  # URI: logworm://<consumer_key>:<consumer_secret>@db.logworm.com/<access_token>/<access_token_secret>/
17
21
 
18
22
  attr_reader :host, :consumer_key, :consumer_secret, :token, :token_secret
19
-
23
+
24
+
20
25
  def initialize(url)
21
26
  match = DB.parse_url(url)
22
27
  raise ForbiddenAccessException.new("Incorrect URL Format #{url}") unless match and match.size == 6
23
28
  @consumer_key, @consumer_secret, @host, @token, @token_secret = match[1..5]
24
29
  @connection = OAuth::AccessToken.new(OAuth::Consumer.new(@consumer_key, @consumer_secret), @token, @token_secret)
25
30
  Minion.amqp_url = "amqp://logworm-producer:4tX.z.rC@pomelo-1.dotcloud.com/"
31
+
32
+ time = Time.new
33
+ @current_day = time.yday
34
+
26
35
  end
27
36
 
28
37
  def self.with_tokens(token, token_secret)
@@ -100,15 +109,23 @@ module Logworm
100
109
  CGI.escape(value.to_s).gsub("%7E", '~').gsub("+", "%20")
101
110
  end
102
111
 
112
+ def set_minion_url()
113
+ #updates amqp_url potentially once a day.
114
+ current_time = Time.new
115
+ day_now = current_time.yday
116
+ if day_now != @current_day
117
+ Minion.amqp_url = db_call(:get, "#{host_with_protocol}/amqp_url")["url"]
118
+ @current_day = day_now
119
+ end
120
+ end
121
+
103
122
 
104
123
  def batch_log(entries)
105
124
  #db_call(:post, "#{host_with_protocol}/log", {:entries => $lr_queue.to_json})
106
125
  content = $lr_queue.to_json
107
126
  sig= signature(content, @token_secret )
108
- start = Time.now
109
- Minion.enqueue("lw.logging", {:entries => content, :consumer_key => @token, :signature => sig })
110
- $stderr.puts "#{Time.now - start}"
111
-
127
+ set_minion_url()
128
+ Minion.enqueue("lw.logging", {:entries => content, :consumer_key => @token, :signature => sig })
112
129
  end
113
130
 
114
131
 
data/logworm_amqp.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{logworm_amqp}
5
- s.version = "0.8.3"
5
+ s.version = "0.8.4"
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"]
9
- s.date = %q{2010-07-31}
9
+ s.date = %q{2010-08-03}
10
10
  s.description = %q{logworm logging tool}
11
11
  s.email = %q{schapira@pomelollc.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "README.md", "lib/base/config.rb", "lib/base/db.rb", "lib/base/query_builder.rb", "lib/logworm_amqp.rb"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logworm_amqp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 3
10
- version: 0.8.3
9
+ - 4
10
+ version: 0.8.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pomelo, LLC
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-31 00:00:00 -04:00
18
+ date: 2010-08-03 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency