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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 023eae85150bb15464a871b31b5764d332dfade7
4
- data.tar.gz: eec85224925a6500bb50f59a3da7a72af7c94a94
3
+ metadata.gz: 986a9392cab3a3e8a01e5f3e28ad296b21a76c5b
4
+ data.tar.gz: 0e61c8536f23e9de1183254c3be9b112fff53cab
5
5
  SHA512:
6
- metadata.gz: 7f85d6ebf2dda93023861ca7fa6a3bdd774cbae276bad00959843ed7bef4d2b3d3663cee6baf61bdc13496f4b2c36d736f61da59a1d2ce5c07e8291326873825
7
- data.tar.gz: 93bb7f9a8f3798e3508c69729f2e606f0e72a9e15398e39a830d24491352f0a47201c79a5fd208c0bd82198e67abe7d14c0c53f06f249948dc2144ab3a0c1b9e
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
@@ -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
- # puts "Oohlalog Exception**: #{ex}"
114
+ # puts "Oohlalog Exception**: #{ex}"
106
115
  end
107
116
  end
108
117
 
@@ -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'
@@ -1,3 +1,3 @@
1
1
  module Oohlalog
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.2"
3
3
  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: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes