timber 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +13 -9
- data/CHANGELOG.md +7 -0
- data/lib/timber/current_context.rb +7 -0
- data/lib/timber/events/custom.rb +2 -2
- data/lib/timber/util/attribute_normalizer.rb +1 -1
- data/lib/timber/util/hash.rb +2 -2
- data/lib/timber/version.rb +1 -1
- data/spec/timber/events/custom_spec.rb +15 -1
- data/spec/timber/util/hash_spec.rb +30 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb990174a93469450d73ae20ffd997d61ca0f01e
|
4
|
+
data.tar.gz: 0f7ada34254928c3b196b5e33ab5e7b11dbc3982
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 859c860cb28a5e11d6901ca8648e8e3467b43ac21131e4c33f5601883c8543427a21709f4f19827728ed0d0cddfe5ddfb176851109d69e5c4d8b3eb5ee11d701
|
7
|
+
data.tar.gz: 10750c2cdd80151a56dee093f0c63e8180d4875235092e795a69ea1d459108e7f02f246251492267d1bacaf32ad1e3b36dc98e0db9dd4b696c2680b7518b7270
|
data/.travis.yml
CHANGED
@@ -28,22 +28,26 @@ script:
|
|
28
28
|
matrix:
|
29
29
|
fast_finish: true
|
30
30
|
exclude:
|
31
|
-
- rvm:
|
31
|
+
- rvm: 1.9.3
|
32
|
+
- rvm: 2.2.6
|
33
|
+
gemfile: gemfiles/rails-edge.gemfile
|
34
|
+
- rvm: 2.3.3
|
35
|
+
gemfile: gemfiles/rails-edge.gemfile
|
32
36
|
include:
|
33
|
-
- rvm:
|
34
|
-
gemfile:
|
35
|
-
- rvm:
|
36
|
-
gemfile:
|
37
|
-
- rvm:
|
38
|
-
gemfile:
|
37
|
+
- rvm: 1.9.3
|
38
|
+
gemfile: gemfiles/rails-3.0.gemfile
|
39
|
+
- rvm: 1.9.3
|
40
|
+
gemfile: gemfiles/rails-3.1.gemfile
|
41
|
+
- rvm: 1.9.3
|
42
|
+
gemfile: gemfiles/rails-3.2.gemfile
|
39
43
|
allow_failures:
|
40
44
|
- rvm: 1.9.3 # bundler wont install the gems
|
41
45
|
- rvm: 2.4.2
|
42
46
|
gemfile: gemfiles/rails-4.0.gemfile
|
43
47
|
- rvm: 2.4.2
|
44
48
|
gemfile: gemfiles/rails-4.1.gemfile
|
45
|
-
- rvm:
|
46
|
-
- rvm:
|
49
|
+
- rvm: jruby-1.7.26
|
50
|
+
- rvm: jruby-9.1.9.0
|
47
51
|
notifications:
|
48
52
|
email: false
|
49
53
|
slack:
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [2.6.2] - 2018-10-17
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Fixes an issue where logging without specifying data would raise an error
|
15
|
+
- Fix nested hash in parameters not showing up in logs
|
16
|
+
|
10
17
|
## [2.6.1] - 2017-11-28
|
11
18
|
|
12
19
|
### Fixed
|
@@ -57,6 +57,13 @@ module Timber
|
|
57
57
|
# # ... anything logged here will include the context ...
|
58
58
|
# end
|
59
59
|
#
|
60
|
+
# @note Any custom context needs to have a single root key to be valid. i.e. instead of:
|
61
|
+
# Timber::CurrentContext.with(job_id: "123", job_name: "Refresh User Account")
|
62
|
+
#
|
63
|
+
# do
|
64
|
+
#
|
65
|
+
# Timber::CurrentContext.with(job: {job_id: "123", job_name: "Refresh User Account"})
|
66
|
+
#
|
60
67
|
# @example Adding multiple contexts
|
61
68
|
# Timber::CurrentContext.with(context1, context2) { ... }
|
62
69
|
def with(*objects)
|
data/lib/timber/events/custom.rb
CHANGED
@@ -27,7 +27,7 @@ module Timber
|
|
27
27
|
@type = normalizer.fetch!(:type, :symbol)
|
28
28
|
@message = normalizer.fetch!(:message, :string)
|
29
29
|
|
30
|
-
data = normalizer.fetch
|
30
|
+
data = normalizer.fetch(:data, :hash, default: {})
|
31
31
|
|
32
32
|
if !data.nil? && data[:time_ms].is_a?(Time)
|
33
33
|
data[:time_ms] = Timer.duration_ms(data[:time_ms])
|
@@ -50,4 +50,4 @@ module Timber
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
-
end
|
53
|
+
end
|
data/lib/timber/util/hash.rb
CHANGED
@@ -83,8 +83,8 @@ module Timber
|
|
83
83
|
# We use is_a? because it accounts for inheritance.
|
84
84
|
def is_a_primitive_type?(v)
|
85
85
|
v.is_a?(Array) || v.is_a?(Integer) || v.is_a?(Float) || v.is_a?(TrueClass) ||
|
86
|
-
v.is_a?(FalseClass) || v.is_a?(String) || v.is_a?(Time)
|
86
|
+
v.is_a?(FalseClass) || v.is_a?(String) || v.is_a?(Time) || v.is_a?(::Hash)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
|
-
end
|
90
|
+
end
|
data/lib/timber/version.rb
CHANGED
@@ -19,4 +19,18 @@ describe Timber::Events::Custom, :rails_23 => true do
|
|
19
19
|
expect(data[:time_ms]).to be > 0.0
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
|
+
describe "#new" do
|
24
|
+
it "does not require data key" do
|
25
|
+
custom_event = described_class.new(:type => "my type", :message => "hello")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "#as_json" do
|
30
|
+
it "should render an empty data hash" do
|
31
|
+
custom_event = described_class.new(:type => "my type", :message => "hello")
|
32
|
+
hash = custom_event.as_json()
|
33
|
+
expect(hash).to eq({:custom => {:"my type" => {}}})
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Timber::Util::Hash, :rails_23 => true do
|
4
|
+
describe "jsonify" do
|
5
|
+
it "should return the original for simple 1 level hash" do
|
6
|
+
original = { a: "a", b: 1, c: 123.11 }
|
7
|
+
v = jsonify(original)
|
8
|
+
expect(v).to eq(original)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should return the original when it's a multilevel hash but with supported values" do
|
12
|
+
original = { a: "a", nested: { b: 1 } }
|
13
|
+
v = jsonify(original)
|
14
|
+
expect(v).to eq(original)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "cuts out ASCII strings longer than 1000 characters from the hash" do
|
18
|
+
file1 = ("a" * 1005).encode("ASCII-8BIT")
|
19
|
+
file2 = ("x" * 1010).encode("ASCII-8BIT")
|
20
|
+
original = { path: "abc", file: file1, nested: { path: "def", file: file2 } }
|
21
|
+
v = jsonify(original)
|
22
|
+
expect(v).to eq({ path: "abc", nested: { path: "def" } })
|
23
|
+
end
|
24
|
+
|
25
|
+
def jsonify(h)
|
26
|
+
Timber::Util::Hash.jsonify(h)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timber Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -293,6 +293,7 @@ files:
|
|
293
293
|
- spec/timber/log_entry_spec.rb
|
294
294
|
- spec/timber/logger_spec.rb
|
295
295
|
- spec/timber/util/attribute_normalizer_spec.rb
|
296
|
+
- spec/timber/util/hash_spec.rb
|
296
297
|
- spec/timber/util/request_spec.rb
|
297
298
|
- timber.gemspec
|
298
299
|
homepage: https://github.com/timberio/timber-ruby
|
@@ -364,4 +365,5 @@ test_files:
|
|
364
365
|
- spec/timber/log_entry_spec.rb
|
365
366
|
- spec/timber/logger_spec.rb
|
366
367
|
- spec/timber/util/attribute_normalizer_spec.rb
|
368
|
+
- spec/timber/util/hash_spec.rb
|
367
369
|
- spec/timber/util/request_spec.rb
|