huyegger 0.4.2 → 0.4.3

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: 58b7af8010c5ed26f1d6c615ddc650c03d746693
4
- data.tar.gz: fec54a00dd42ced9a8a2804d83b06747d2ba6efe
3
+ metadata.gz: ba0573ca9cce1a96331b7ba3b2280e2d51f95bde
4
+ data.tar.gz: 2fb692f9c463ddf0caaef0d1623928818d6b446e
5
5
  SHA512:
6
- metadata.gz: d9057e6d7e5572fb83e68f39f7ec24d8d1da47e6de58f2b736535e2073cf495312ad3375436eefadb118a1861aac6910b6d5d459faeef9cc845ebe3df4c01073
7
- data.tar.gz: 0c975f4b79888795cca0f402ab3f485e103ae5a63316b70dd34617ac8ec490d125ab8ef888f98fd5aef386037366ade1c61df19623c7624e1ee51a7d2e1e4aff
6
+ metadata.gz: f5585b37ee8873d2ef27a8979780dcb8bc226f18f91a385a3886103cd6b78722d14dcba140c51c0b6b794cc5b562afe973e545a4a001106bd035958cb4e158f3
7
+ data.tar.gz: 45f8cab131db38d798963d2b5d90381b3d66e152d63f44386a1be6eed457e4635e0cb52c977aeec60da8b4e07a918d9a434c0fc682506046c5a72de37a95c622
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -0,0 +1,20 @@
1
+
2
+ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
3
+
4
+ ## Prerelease versions
5
+
6
+ According to https://semver.org/#spec-item-4 0.x versions should not be considered as stable, anything can change at any time.
7
+
8
+ ## [Unreleased]
9
+
10
+ ## 0.4.3 - 2018-05-28
11
+
12
+ - Fixed double message keys:
13
+
14
+ ```ruby
15
+ # before fix
16
+ logger.info(message: 'test') # => "{ ...,"message":"Empty message","message":"test"}"
17
+
18
+ # after fix
19
+ logger.info(message: 'test') # => "{ ...,"message":"test"}"
20
+ ```
data/README.md CHANGED
@@ -25,20 +25,20 @@ logger = Huyegger::Logger.new(syslog_logger)
25
25
 
26
26
  # Write messages:
27
27
  logger.info "log message"
28
- # => { "level": "INFO", "message": "test" }
28
+ # => { "level": "INFO", "message": "log message" }
29
29
  logger.info { "http.host" => "127.0.0.1", message: "log message" }
30
- # => { "level": "INFO", "message": "test", "http.host": "127.0.0.1" }
30
+ # => { "level": "INFO", "message": "log message", "http.host": "127.0.0.1" }
31
31
 
32
32
  # Store context for all log messages, it will be merged to resulting messages
33
33
  logger.context("http.host" => "127.0.0.1")
34
- logger.info("test")
35
- # => { "level": "INFO", "message": "test", "http.host": "127.0.0.1" }
34
+ logger.info("log message")
35
+ # => { "level": "INFO", "message": "log message", "http.host": "127.0.0.1" }
36
36
 
37
37
  # Remove context
38
38
  logger.purge_context!
39
39
 
40
40
  # Configure json encoder
41
- Huyegger.json_encoder = proc { |obj, *opts| Oj.dump(obj, *opts) }
41
+ Huyegger.json_encoder = proc { |obj| Oj.dump(obj, mode: :compat) }
42
42
 
43
43
  # Default implementation of json_encoder uses `Object#to_json`,
44
44
  # but you need to `require "json"` to use default json encoder.
@@ -9,4 +9,12 @@ module Huyegger
9
9
  end
10
10
 
11
11
  self.json_encoder = DEFAULT_JSON_ENCODER
12
+
13
+ def self.stringify_keys(hash)
14
+ Hash.new.tap do |new_hash|
15
+ hash.each do |key, value|
16
+ new_hash[key.to_s] = value
17
+ end
18
+ end
19
+ end
12
20
  end
@@ -32,7 +32,7 @@ module Huyegger
32
32
  json_message = {}
33
33
 
34
34
  add_severity!(json_message, severity)
35
- json_message.merge!(__context__)
35
+ json_message.merge!(Huyegger.stringify_keys(__context__))
36
36
  add_message!(json_message, msg)
37
37
 
38
38
  "#{Huyegger.json_encoder.call(json_message)}\n"
@@ -57,7 +57,7 @@ module Huyegger
57
57
  json_message.merge!("message" => msg)
58
58
  when Hash
59
59
  json_message.merge!("message" => "Empty message") # default message because it is required
60
- json_message.merge!(msg)
60
+ json_message.merge!(Huyegger.stringify_keys(msg))
61
61
  else
62
62
  json_message.merge!("message" => msg.inspect)
63
63
  end
@@ -1,3 +1,3 @@
1
1
  module Huyegger
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: huyegger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikolay Markov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-26 00:00:00.000000000 Z
11
+ date: 2018-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,6 +60,7 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".gitignore"
63
+ - CHANGELOG.md
63
64
  - Gemfile
64
65
  - LICENSE.txt
65
66
  - README.md