oohlalog 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/oohlalog.rb +3 -1
- data/lib/oohlalog/logger.rb +11 -2
- data/lib/oohlalog/railtie.rb +2 -2
- data/lib/oohlalog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 986a9392cab3a3e8a01e5f3e28ad296b21a76c5b
|
4
|
+
data.tar.gz: 0e61c8536f23e9de1183254c3be9b112fff53cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b99b09511984567e0b715772058bf2fb2bb033a55ae86167e6e1677cb368a66646c4e7719d79b4bf0345a45d863acc546a18ef630ef9b0d9bbf1e217187fb26
|
7
|
+
data.tar.gz: 4c6ed3f96332ea165af532cc5f607ed64adceb9b349e96e01628ae42a7a3d36847f03a342ad893b29211c993fe36b815eda115b1f7e348aefef4ef70c6f630a0
|
data/lib/oohlalog.rb
CHANGED
@@ -12,7 +12,9 @@ module Oohlalog
|
|
12
12
|
@agent = "ruby"
|
13
13
|
@inject_rails = true
|
14
14
|
@secure = false
|
15
|
+
@tags = nil
|
16
|
+
@session_tag = nil
|
15
17
|
class << self
|
16
|
-
attr_accessor :api_key, :host, :port, :path, :inject_rails, :agent, :secure
|
18
|
+
attr_accessor :api_key, :host, :port, :path, :inject_rails, :agent, :secure, :tags, :session_tag
|
17
19
|
end
|
18
20
|
end
|
data/lib/oohlalog/logger.rb
CHANGED
@@ -28,6 +28,9 @@ class Oohlalog::Logger
|
|
28
28
|
@agent = options["agent"]
|
29
29
|
end
|
30
30
|
|
31
|
+
@tags =Oohlalog.tags
|
32
|
+
@session_tag = Oohlalog.session_tag
|
33
|
+
|
31
34
|
@secure = Oohlalog.secure
|
32
35
|
@buffer_size = buffer_size
|
33
36
|
@buffer = []
|
@@ -36,10 +39,16 @@ class Oohlalog::Logger
|
|
36
39
|
|
37
40
|
def add(severity, message, category=nil, details=nil)
|
38
41
|
log_message = message
|
42
|
+
|
39
43
|
if message.nil? || message.to_s.empty?
|
40
44
|
log_message = category
|
41
45
|
category = nil
|
42
46
|
end
|
47
|
+
if category == message
|
48
|
+
category = nil
|
49
|
+
end
|
50
|
+
|
51
|
+
session = Thread.current[:session_id]
|
43
52
|
|
44
53
|
return if log_message.nil? || log_message.to_s.empty?
|
45
54
|
|
@@ -47,7 +56,7 @@ class Oohlalog::Logger
|
|
47
56
|
if details.nil? && defined?(log_message.backtrace)
|
48
57
|
details = log_message.backtrace.join("\n")
|
49
58
|
end
|
50
|
-
@buffer << {level: severity_string(severity), message: log_message.to_s.gsub(/\e\[(\d+)m/, ''), agent: @agent , category: category, details: details, timestamp:Time.now.to_i * 1000, hostName: Socket.gethostname}
|
59
|
+
@buffer << {level: severity_string(severity), message: log_message.to_s.gsub(/\e\[(\d+)m/, ''), agent: @agent , category: category, details: details, timestamp:Time.now.to_i * 1000, hostName: Socket.gethostname, token: session}
|
51
60
|
check_buffer_size
|
52
61
|
return
|
53
62
|
end
|
@@ -102,7 +111,7 @@ private
|
|
102
111
|
http_net.read_timeout = 5
|
103
112
|
http_net.start {|http| http.request(request) }
|
104
113
|
rescue Exception => ex
|
105
|
-
|
114
|
+
# puts "Oohlalog Exception**: #{ex}"
|
106
115
|
end
|
107
116
|
end
|
108
117
|
|
data/lib/oohlalog/railtie.rb
CHANGED
@@ -2,7 +2,7 @@ module Oohlalog
|
|
2
2
|
if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
3
3
|
require 'oohlalog/buffered_logger'
|
4
4
|
class Railtie < Rails::Railtie
|
5
|
-
initializer "oohlalog" do |app|
|
5
|
+
initializer "oohlalog", :after => :load_config_initializers do |app|
|
6
6
|
if Oohlalog.inject_rails && Oohlalog.api_key
|
7
7
|
if Oohlalog.agent == 'ruby'
|
8
8
|
Oohlalog.agent = 'rails'
|
@@ -17,7 +17,7 @@ module Oohlalog
|
|
17
17
|
require 'logger'
|
18
18
|
require 'oohlalog/buffered_logger'
|
19
19
|
class Railtie < Rails::Railtie
|
20
|
-
initializer "oohlalog" do |app|
|
20
|
+
initializer "oohlalog", :after => :load_config_initializers do |app|
|
21
21
|
if Oohlalog.inject_rails && Oohlalog.api_key
|
22
22
|
if Oohlalog.agent == 'ruby'
|
23
23
|
Oohlalog.agent = 'rails'
|
data/lib/oohlalog/version.rb
CHANGED