brm-ruby-logger 0.1.0 → 0.2.0

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.
Files changed (5) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +11 -0
  3. data/VERSION +1 -1
  4. data/lib/brm-ruby-logger.rb +6 -6
  5. metadata +3 -3
data/.gitignore CHANGED
@@ -17,5 +17,6 @@ tmtags
17
17
  coverage
18
18
  rdoc
19
19
  pkg
20
+ tmp
20
21
 
21
22
  ## PROJECT::SPECIFIC
data/Rakefile CHANGED
@@ -1,6 +1,17 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
 
4
+ begin
5
+ require 'metric_fu' rescue LoadError
6
+ MetricFu::Configuration.run do |config|
7
+ config.metrics = [:flog, :flay, :reek, :saikuro]
8
+ config.graphs = [:flog, :flay, :reek]
9
+ config.graph_engine = :gchart
10
+ end
11
+ rescue LoadError
12
+ puts "Metric_fu (or a dependency) not available. Install it with: gem install metric_fu"
13
+ end
14
+
4
15
  begin
5
16
  require 'jeweler'
6
17
  Jeweler::Tasks.new do |gem|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -3,7 +3,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require "rubygems"
4
4
  require "bunny"
5
5
  require "active_support"
6
- require "pp"
6
+ require "json"
7
7
 
8
8
  require "logger/event.rb"
9
9
 
@@ -25,16 +25,17 @@ module BrmLogger
25
25
  bunny_options = args.extract_options!
26
26
  @connection = Bunny.new bunny_options
27
27
  @connection.start
28
+ @queue = @connection.queue "/"
28
29
  end
29
30
 
30
31
  def disconnect()
31
32
  @connection.stop
32
33
  end
33
34
 
34
- def event(eventName, data=nil, context=nil, event_ref="")
35
+ def event(event_name, data=nil, context=nil, event_ref="")
35
36
  event = HashWithIndifferentAccess.new
36
37
  event["data"] = data || {}
37
- event["context"] = context || {}
38
+ event["context"] ||= {}
38
39
 
39
40
 
40
41
  event["data"]["agent"] = {:id => facet_id, :type => "facet"} if facet_id
@@ -43,10 +44,9 @@ module BrmLogger
43
44
  event["data"]["agent"] ||= {:id => user_id, :type => "user"}
44
45
  event["context"]["userID"] = user_id
45
46
  end
46
-
47
47
  event["metaData"] = {
48
48
  "timestamp" => Time.now.to_i * 1000,
49
- "eventName" => $eventName,
49
+ "eventName" => event_name,
50
50
  "application" => application,
51
51
  "loggerVersion" => VERSION,
52
52
  "loggerType" => "ruby",
@@ -62,7 +62,7 @@ module BrmLogger
62
62
 
63
63
  private
64
64
  def send event
65
-
65
+ @queue.publish event.to_json
66
66
  end
67
67
  end
68
68
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - mathieuravaux
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-08 00:00:00 +01:00
17
+ date: 2010-03-09 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency