oohlalog 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,14 @@ class Oohlalog::Logger
14
14
  include Severity
15
15
 
16
16
  def initialize(buffer_size=100, level = DEBUG, options={})
17
- @api_key = options["api_key"] || options[:api_key] || Oohlalog.api_key
17
+ @api_key = Oohlalog.api_key
18
+ if options.has_key? :api_key
19
+ @api_key = options[:api_key]
20
+ elsif options.has_key? "api_key"
21
+ @api_key = options["api_key"]
22
+ end
23
+
24
+
18
25
  @buffer_size = buffer_size
19
26
  @buffer = []
20
27
  self.level = level
@@ -67,7 +74,7 @@ class Oohlalog::Logger
67
74
  private
68
75
  def send_payload(payload)
69
76
  begin
70
- request = Net::HTTP::Post.new("#{Oohlalog.path}?apiKey=#{@api_key}",{'Content-Type' =>'application/json'})
77
+ request = Net::HTTP::Post.new("#{Oohlalog.path}?apiKey=#{@api_key || Oohlalog.api_key}",{'Content-Type' =>'application/json'})
71
78
  request.body = payload.to_json
72
79
  http_net = Net::HTTP.new(Oohlalog.host, Oohlalog.port)
73
80
  http_net.read_timeout = 5
@@ -3,8 +3,10 @@ module Oohlalog
3
3
  require 'oohlalog/buffered_logger'
4
4
  class Railtie < Rails::Railtie
5
5
  initializer "oohlalog" do |app|
6
- ActiveSupport::BufferedLogger.instance_eval do
7
- include BufferedLogger
6
+ if Oohlalog.inject_rails
7
+ ActiveSupport::BufferedLogger.instance_eval do
8
+ include BufferedLogger
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -13,8 +15,10 @@ module Oohlalog
13
15
  require 'oohlalog/buffered_logger'
14
16
  class Railtie < Rails::Railtie
15
17
  initializer "oohlalog" do |app|
16
- ::Logger.instance_eval do
17
- include BufferedLogger
18
+ if Oohlalog.inject_rails
19
+ ::Logger.instance_eval do
20
+ include BufferedLogger
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -1,3 +1,3 @@
1
1
  module Oohlalog
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/oohlalog.rb CHANGED
@@ -9,7 +9,8 @@ module Oohlalog
9
9
  @port = 80
10
10
  @path = "/api/logging/save.json"
11
11
  @api_key = nil
12
+ @inject_rails = true
12
13
  class << self
13
- attr_accessor :api_key, :host, :port, :path
14
+ attr_accessor :api_key, :host, :port, :path, :inject_rails
14
15
  end
15
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oohlalog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-26 00:00:00.000000000 Z
12
+ date: 2013-09-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Rails/Ruby Logger Tie-in for OohLaLog.com
15
15
  email: