semantic_logger 4.13.0 → 4.15.0

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
  SHA256:
3
- metadata.gz: 0c00e5f1ab5a36a350afa8a082d367ec78c59b62bcfc29027fa843be48b658d4
4
- data.tar.gz: 5d77c0d14230c349b5dd58aa29b8f625ea867f7600665482a724b8f13db44f49
3
+ metadata.gz: fcbc97117f68557ed7ffb4a60ccc482f712462436e4c612041d3496458f67826
4
+ data.tar.gz: a847bf4a506663eb3e6c6f428fe53ae7a4f647589d10e129e9d64b0c40ef1ebe
5
5
  SHA512:
6
- metadata.gz: e8c85cca0bf54d04235b12030c0602cdea04b597fcac1544819f25e1b3c40ae35a0874ed7d8b1286db370f5e4d122f812f2437f3e32c20ab45e443f3a735f641
7
- data.tar.gz: 172a1ff0b357792afba013577a326e1e2a9ea1bf3b8e83d01f8e0424e2ae9332053322ccbbda328c3607930a7f9cdec0aa5d05daa5b871fdf75182fc806d731b
6
+ metadata.gz: 4069c6fa8e26e84287ef4a521b83663d6bd8976e61d1793fd6c761c0c7714a1a8a3e5a34c29faf35b7f8e3e425404831c9e44d37d6fe3dca8a7271b791231332
7
+ data.tar.gz: 5deba5054ad0e7e4240d88e705ef0862af3e72afd4219d7ac9ff99cee892f45efbf1de432b1dbadc976270ef19db6958dd0a4d6c4f35bc1203dfc2a4a4f0a356
@@ -37,6 +37,7 @@ module SemanticLogger
37
37
  #
38
38
  # type: [String]
39
39
  # Document type to associate with logs when they are written.
40
+ # Deprecated in Elasticsearch 7.0.0.
40
41
  # Default: 'log'
41
42
  #
42
43
  # level: [:trace | :debug | :info | :warn | :error | :fatal]
@@ -193,7 +194,9 @@ module SemanticLogger
193
194
  if @data_stream
194
195
  {"create" => {}}
195
196
  else
196
- {"index" => {"_index" => expanded_index_name, "_type" => type}}
197
+ bulk_index = {"index" => {"_index" => expanded_index_name}}
198
+ bulk_index["index"].merge!({ "_type" => type }) if version_supports_type?
199
+ bulk_index
197
200
  end
198
201
  end
199
202
 
@@ -206,6 +209,12 @@ module SemanticLogger
206
209
 
207
210
  SemanticLogger::Formatters::Raw.new(time_format: :iso_8601, time_key: time_key)
208
211
  end
212
+
213
+ private
214
+
215
+ def version_supports_type?
216
+ Gem::Version.new(::Elasticsearch::VERSION) < Gem::Version.new(7)
217
+ end
209
218
  end
210
219
  end
211
220
  end
@@ -26,6 +26,7 @@ module SemanticLogger
26
26
  #
27
27
  # type: [String]
28
28
  # Document type to associate with logs when they are written.
29
+ # Deprecated in Elasticsearch 7.0.0
29
30
  # Default: 'log'
30
31
  #
31
32
  # level: [:trace | :debug | :info | :warn | :error | :fatal]
@@ -48,6 +48,11 @@ module SemanticLogger
48
48
  # password: [String]
49
49
  # Password for basic Authentication.
50
50
  #
51
+ # header: [Hash]
52
+ # Custom HTTP headers to send with each request.
53
+ # Default: {} ( do not send any custom headers)
54
+ # Example: {"Authorization" => "Bearer BEARER_TOKEN"}
55
+ #
51
56
  # compress: [true|false]
52
57
  # Whether to compress the JSON string with GZip.
53
58
  # Default: false
@@ -95,6 +100,7 @@ module SemanticLogger
95
100
  ssl: {},
96
101
  username: nil,
97
102
  password: nil,
103
+ header: {},
98
104
  proxy_url: :ENV,
99
105
  open_timeout: 2.0,
100
106
  read_timeout: 1.0,
@@ -118,7 +124,7 @@ module SemanticLogger
118
124
  "Content-Type" => "application/json",
119
125
  "Connection" => "keep-alive",
120
126
  "Keep-Alive" => "300"
121
- }
127
+ }.merge(header)
122
128
  @header["Content-Encoding"] = "gzip" if @compress
123
129
 
124
130
  uri = URI.parse(@url)
@@ -226,7 +232,7 @@ module SemanticLogger
226
232
  end
227
233
  request.basic_auth(@username, @password) if @username
228
234
  response = @http.request(request)
229
- if response.code == "200" || response.code == "201"
235
+ if response.is_a?(Net::HTTPSuccess)
230
236
  true
231
237
  else
232
238
  # Failures are logged to the global semantic logger failsafe logger (Usually stderr or file)
@@ -219,11 +219,11 @@ module SemanticLogger
219
219
 
220
220
  seconds = duration / 1000
221
221
  if seconds >= 86_400.0 # 1 day
222
- "#{(seconds / 86_400).to_i}d #{Time.at(seconds).strftime('%-Hh %-Mm')}"
222
+ "#{(seconds / 86_400).to_i}d #{Time.at(seconds).utc.strftime('%-Hh %-Mm')}"
223
223
  elsif seconds >= 3600.0 # 1 hour
224
- Time.at(seconds).strftime("%-Hh %-Mm")
224
+ Time.at(seconds).utc.strftime("%-Hh %-Mm")
225
225
  elsif seconds >= 60.0 # 1 minute
226
- Time.at(seconds).strftime("%-Mm %-Ss")
226
+ Time.at(seconds).utc.strftime("%-Mm %-Ss")
227
227
  elsif seconds >= 1.0 # 1 second
228
228
  "#{format('%.3f', seconds)}s"
229
229
  else
@@ -1,3 +1,3 @@
1
1
  module SemanticLogger
2
- VERSION = "4.13.0".freeze
2
+ VERSION = "4.15.0".freeze
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: 4.13.0
4
+ version: 4.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-26 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -98,7 +98,11 @@ files:
98
98
  homepage: https://logger.rocketjob.io
99
99
  licenses:
100
100
  - Apache-2.0
101
- metadata: {}
101
+ metadata:
102
+ bug_tracker_uri: https://github.com/reidmorrison/semantic_logger/issues
103
+ documentation_uri: https://logger.rocketjob.io
104
+ source_code_uri: https://github.com/reidmorrison/semantic_logger/tree/4.15.0
105
+ rubygems_mfa_required: 'true'
102
106
  post_install_message:
103
107
  rdoc_options: []
104
108
  require_paths: