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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +20 -0
- data/README.md +5 -5
- data/lib/huyegger.rb +8 -0
- data/lib/huyegger/formatter.rb +2 -2
- data/lib/huyegger/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba0573ca9cce1a96331b7ba3b2280e2d51f95bde
|
4
|
+
data.tar.gz: 2fb692f9c463ddf0caaef0d1623928818d6b446e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5585b37ee8873d2ef27a8979780dcb8bc226f18f91a385a3886103cd6b78722d14dcba140c51c0b6b794cc5b562afe973e545a4a001106bd035958cb4e158f3
|
7
|
+
data.tar.gz: 45f8cab131db38d798963d2b5d90381b3d66e152d63f44386a1be6eed457e4635e0cb52c977aeec60da8b4e07a918d9a434c0fc682506046c5a72de37a95c622
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -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": "
|
28
|
+
# => { "level": "INFO", "message": "log message" }
|
29
29
|
logger.info { "http.host" => "127.0.0.1", message: "log message" }
|
30
|
-
# => { "level": "INFO", "message": "
|
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("
|
35
|
-
# => { "level": "INFO", "message": "
|
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
|
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.
|
data/lib/huyegger.rb
CHANGED
data/lib/huyegger/formatter.rb
CHANGED
@@ -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
|
data/lib/huyegger/version.rb
CHANGED
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.
|
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:
|
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
|