oohlalog 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/oohlalog/logger.rb +9 -2
- data/lib/oohlalog/railtie.rb +8 -4
- data/lib/oohlalog/version.rb +1 -1
- data/lib/oohlalog.rb +2 -1
- metadata +2 -2
data/lib/oohlalog/logger.rb
CHANGED
@@ -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 =
|
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
|
data/lib/oohlalog/railtie.rb
CHANGED
@@ -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
|
-
|
7
|
-
|
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
|
-
|
17
|
-
|
18
|
+
if Oohlalog.inject_rails
|
19
|
+
::Logger.instance_eval do
|
20
|
+
include BufferedLogger
|
21
|
+
end
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
data/lib/oohlalog/version.rb
CHANGED
data/lib/oohlalog.rb
CHANGED
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
|
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-
|
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:
|