semantic_logger 3.2.0 → 3.2.1

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: efbdb066c354033b8f3e16d20855e5cd41a9ca14
4
- data.tar.gz: cbbf43104fc6fc965f0aceb66c1aa39e83927779
3
+ metadata.gz: 93bacb9e50c85d3c705135737294436245cf1260
4
+ data.tar.gz: 76f4ea34ce009dec4d498c738a149ca59a3d952f
5
5
  SHA512:
6
- metadata.gz: 973c536da77a0c8346c039a2564aa7d01b70b4e5ff859e0d7c45eb5c956affa41e052302d87ef7483c72cf7b2868d73ccc3a6280edc9d78f2aae3d8adfa93db0
7
- data.tar.gz: 13e0efe329c732223cb76e12289a934c556830d424b9881e52dcd8023f76b0a8e9c8c17734fa2f1f822d67ee673945fe5c0da3aeb6be6c70cd15489baf9fb4ba
6
+ metadata.gz: 0658a00169d903ef6605fa5e5a29bc50f84e3a8381a6c0e9143308885bc8764ca3ba41e3691526b690d220f4eb10f6b13f4f926bf74ea4d90cf6c97b69775cf4
7
+ data.tar.gz: 3d2554eefc189f28a9bc1411a4b360583bca3342e531ba9f7cfa0a7fcbcc7f37012f97e60ff82eb39dcdb495a518443b09fa246ea8387a60853be618b909d0e2
@@ -114,7 +114,7 @@ module SemanticLogger
114
114
  # Since only one appender thread will be writing to the file at a time
115
115
  # it is not necessary to protect access to the file with a semaphore
116
116
  # Allow this logger to filter out log levels lower than it's own
117
- @log.write(@formatter.call(log, self) << "\n")
117
+ @log.write(formatter.call(log, self) << "\n")
118
118
  true
119
119
  end
120
120
 
@@ -51,8 +51,8 @@ class SemanticLogger::Appender::Http < SemanticLogger::Appender::Base
51
51
  #
52
52
  # ssl: [Hash]
53
53
  # Specific SSL options: For more details see NET::HTTP.start
54
- # ca_file, ca_path, cert, cert_store, ciphers, key, open_timeout, read_timeout, ssl_timeout,
55
- # ssl_version, use_ssl, verify_callback, verify_depth and verify_mode.
54
+ # ca_file, ca_path, cert, cert_store, ciphers, key, ssl_timeout,
55
+ # ssl_version, verify_callback, verify_depth and verify_mode.
56
56
  #
57
57
  # level: [:trace | :debug | :info | :warn | :error | :fatal]
58
58
  # Override the log level for this appender.
@@ -102,9 +102,7 @@ class SemanticLogger::Appender::Http < SemanticLogger::Appender::Base
102
102
  }
103
103
  @header['Content-Encoding'] = 'gzip' if @compress
104
104
 
105
- uri = URI.parse(@url)
106
- (@ssl_options ||= {})[:use_ssl] = true if uri.scheme == 'https'
107
-
105
+ uri = URI.parse(@url)
108
106
  @server = uri.host
109
107
  raise(ArgumentError, "Invalid format for :url: #{@url.inspect}. Should be similar to: 'http://hostname:port/path'") unless @url
110
108
 
@@ -113,6 +111,15 @@ class SemanticLogger::Appender::Http < SemanticLogger::Appender::Base
113
111
  @password = uri.password if !@password && uri.password
114
112
  @path = uri.path
115
113
 
114
+ if uri.scheme == 'https'
115
+ @ssl_options ||= {}
116
+ @ssl_options[:use_ssl] = true
117
+ @ssl_options[:verify_mode] ||= OpenSSL::SSL::VERIFY_PEER
118
+ @port ||= HTTP.https_default_port
119
+ else
120
+ @port ||= HTTP.http_default_port
121
+ end
122
+
116
123
  reopen
117
124
 
118
125
  # Pass on the level and custom formatter if supplied
@@ -122,7 +129,15 @@ class SemanticLogger::Appender::Http < SemanticLogger::Appender::Base
122
129
  # Re-open after process fork
123
130
  def reopen
124
131
  # On Ruby v2.0 and greater, Net::HTTP.new uses a persistent connection if the server allows it
125
- @http = @ssl_options ? Net::HTTP.new(server, port, @ssl_options) : Net::HTTP.new(server, port)
132
+ @http = Net::HTTP.new(server, port)
133
+
134
+ if @ssl_options
135
+ @http.methods.grep(/\A(\w+)=\z/) do |meth|
136
+ key = $1.to_sym
137
+ @ssl_options.key?(key) or next
138
+ @http.__send__(meth, @ssl_options[key])
139
+ end
140
+ end
126
141
 
127
142
  @http.open_timeout = @open_timeout
128
143
  @http.read_timeout = @read_timeout
@@ -1,3 +1,3 @@
1
1
  module SemanticLogger #:nodoc
2
- VERSION = '3.2.0'
2
+ VERSION = '3.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby