vx-instrumentation 0.0.5 → 0.0.6
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 +4 -4
- data/lib/vx/instrumentation/logger.rb +4 -3
- data/lib/vx/instrumentation/version.rb +1 -1
- data/spec/lib/logger_spec.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56e99e02c5dae2b4ec7353e76076122226c1c71e
|
4
|
+
data.tar.gz: 854bb9c8b52c7cfd9644d591bec489e78382803b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 981b646a3a26047e37911260e05a9f6b8449a5363769205c23933b2622cf9b1cc28cc30b71ad1fb1487dd19b0e0c63e2e3ea9236ebc6a138d917d8d66da7c011
|
7
|
+
data.tar.gz: fa8fcfa4c0cde7ac633e43a7eac8c3f8b2c3ae4c1986dafa36f975dccacb8a954c1f7c865b8012ec771bf431b4f80f8e04b44a5bb9fb2994aa347ec8e90aace8
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'logger'
|
3
|
+
require 'active_support/core_ext/hash/deep_merge'
|
3
4
|
|
4
5
|
module Vx
|
5
6
|
|
@@ -75,14 +76,14 @@ module Vx
|
|
75
76
|
|
76
77
|
case
|
77
78
|
when msg.is_a?(Hash)
|
78
|
-
values.
|
79
|
+
values.deep_merge! msg
|
79
80
|
when msg.respond_to?(:to_h)
|
80
81
|
values.merge! msg.to_h
|
81
82
|
else
|
82
|
-
values.
|
83
|
+
values.deep_merge!(message: msg)
|
83
84
|
end
|
84
85
|
|
85
|
-
values.
|
86
|
+
values.deep_merge!(severity: severity.to_s.downcase)
|
86
87
|
|
87
88
|
values = make_safe_hash(values)
|
88
89
|
|
data/spec/lib/logger_spec.rb
CHANGED
@@ -70,7 +70,7 @@ describe Vx::Instrumentation::Logger do
|
|
70
70
|
)
|
71
71
|
end
|
72
72
|
|
73
|
-
it "should
|
73
|
+
it "should work with default values" do
|
74
74
|
Vx::Instrumentation.with(foo: "bar") do
|
75
75
|
logger.info(key: "value")
|
76
76
|
end
|
@@ -80,4 +80,14 @@ describe Vx::Instrumentation::Logger do
|
|
80
80
|
"severity" => "info"
|
81
81
|
)
|
82
82
|
end
|
83
|
+
|
84
|
+
it "should work with nested default values" do
|
85
|
+
Vx::Instrumentation.with("@fields" => {a: 1}) do
|
86
|
+
logger.info("@fields" => {b: 2})
|
87
|
+
end
|
88
|
+
expect(result).to eq(
|
89
|
+
"@fields" => {"a"=>1, "b"=>2},
|
90
|
+
"severity" => "info"
|
91
|
+
)
|
92
|
+
end
|
83
93
|
end
|