oohlalog 1.1.1 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57b9abb7aaa23ae23a49c169ee66b09b0bdd643d
4
- data.tar.gz: da1f9c23f51e36bca9d8cdb190631bb4975dfae5
3
+ metadata.gz: 023eae85150bb15464a871b31b5764d332dfade7
4
+ data.tar.gz: eec85224925a6500bb50f59a3da7a72af7c94a94
5
5
  SHA512:
6
- metadata.gz: a40a3e4adceaf5747c3e9e51bf913767343accf2e0bf47ee15f9aff85d94fbcbf6a6d875efa23154e56e55375248ff4afb71ed26d29dc6b96c99e85fbcd774cc
7
- data.tar.gz: 597f9ee3af749dc8660f6994ab1767b5b2d2eb1082a0bea2443a1f6e7fbae220216a4f091acd3ca0f0cfd6649c958bebb0e5a9354d41c1d62cd804b7deebe664
6
+ metadata.gz: 7f85d6ebf2dda93023861ca7fa6a3bdd774cbae276bad00959843ed7bef4d2b3d3663cee6baf61bdc13496f4b2c36d736f61da59a1d2ce5c07e8291326873825
7
+ data.tar.gz: 93bb7f9a8f3798e3508c69729f2e606f0e72a9e15398e39a830d24491352f0a47201c79a5fd208c0bd82198e67abe7d14c0c53f06f249948dc2144ab3a0c1b9e
data/README.md CHANGED
@@ -51,6 +51,14 @@ To run an independent instance simply create a new log object
51
51
  logger.fatal("Fatal error message")
52
52
  ```
53
53
 
54
+ ### Secure Mode
55
+
56
+ In many cases it may be prudent to ensure secure log communication with our servers. For these high security situations you can enable SSL communication with the `secure` configuration option.
57
+
58
+ ```ruby
59
+ Oohlalog.secure = true
60
+ ```
61
+
54
62
  TODO: Implement Counter support
55
63
 
56
64
 
@@ -21,7 +21,14 @@ class Oohlalog::Logger
21
21
  @api_key = options["api_key"]
22
22
  end
23
23
 
24
+ @agent = Oohlalog.agent
25
+ if options.has_key? :agent
26
+ @agent = options[:agent]
27
+ elsif options.has_key? "agent"
28
+ @agent = options["agent"]
29
+ end
24
30
 
31
+ @secure = Oohlalog.secure
25
32
  @buffer_size = buffer_size
26
33
  @buffer = []
27
34
  self.level = level
@@ -40,7 +47,7 @@ class Oohlalog::Logger
40
47
  if details.nil? && defined?(log_message.backtrace)
41
48
  details = log_message.backtrace.join("\n")
42
49
  end
43
- @buffer << {level: severity_string(severity), message: log_message.to_s.gsub(/\e\[(\d+)m/, '') , category: category, details: details, timestamp:Time.now.to_i * 1000, hostName: Socket.gethostname}
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}
44
51
  check_buffer_size
45
52
  return
46
53
  end
@@ -88,6 +95,10 @@ private
88
95
  request = Net::HTTP::Post.new("#{Oohlalog.path}?apiKey=#{@api_key || Oohlalog.api_key}",{'Content-Type' =>'application/json'})
89
96
  request.body = payload.to_json
90
97
  http_net = Net::HTTP.new(Oohlalog.host, Oohlalog.port)
98
+ if @secure
99
+ http.use_ssl = true
100
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE # read into this
101
+ end
91
102
  http_net.read_timeout = 5
92
103
  http_net.start {|http| http.request(request) }
93
104
  rescue Exception => ex
@@ -4,6 +4,9 @@ module Oohlalog
4
4
  class Railtie < Rails::Railtie
5
5
  initializer "oohlalog" do |app|
6
6
  if Oohlalog.inject_rails && Oohlalog.api_key
7
+ if Oohlalog.agent == 'ruby'
8
+ Oohlalog.agent = 'rails'
9
+ end
7
10
  ActiveSupport::BufferedLogger.instance_eval do
8
11
  include BufferedLogger
9
12
  end
@@ -16,6 +19,9 @@ module Oohlalog
16
19
  class Railtie < Rails::Railtie
17
20
  initializer "oohlalog" do |app|
18
21
  if Oohlalog.inject_rails && Oohlalog.api_key
22
+ if Oohlalog.agent == 'ruby'
23
+ Oohlalog.agent = 'rails'
24
+ end
19
25
  ::Logger.instance_eval do
20
26
  include BufferedLogger
21
27
  end
@@ -1,3 +1,3 @@
1
1
  module Oohlalog
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/oohlalog.rb CHANGED
@@ -9,8 +9,10 @@ module Oohlalog
9
9
  @port = 80
10
10
  @path = "/api/logging/save.json"
11
11
  @api_key = nil
12
+ @agent = "ruby"
12
13
  @inject_rails = true
14
+ @secure = false
13
15
  class << self
14
- attr_accessor :api_key, :host, :port, :path, :inject_rails
16
+ attr_accessor :api_key, :host, :port, :path, :inject_rails, :agent, :secure
15
17
  end
16
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oohlalog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-29 00:00:00.000000000 Z
11
+ date: 2014-08-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails/Ruby Logger Tie-in for OohLaLog.com
14
14
  email: