timber 1.0.10 → 1.0.11
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/README.md +4 -4
- data/lib/timber/log_devices/http.rb +2 -2
- data/lib/timber/logger.rb +2 -1
- data/lib/timber/version.rb +1 -1
- data/spec/timber/log_devices/http_spec.rb +5 -4
- data/spec/timber/logger_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d077443fc6d81d17024ca768f807d246ae550741
|
4
|
+
data.tar.gz: ad06e2613fa515befaf240c91ed03329f75dd432
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ee5c69b706a378a785484b71c3553d103d501b2e4ac47be9a71c53a15f9aa230f01afd6c21b7178e49c651a026fe3504687890e403c8e7c537445910f890c5e
|
7
|
+
data.tar.gz: aeb022f26127fdecde663867d82e1a672a9f211078d0dbd922b1fa4d4bb16f78fbdd4e503e35a9504146a6bcc7cd05a4e6872d2223cf947eef83869fe016b1fb
|
data/README.md
CHANGED
@@ -26,10 +26,10 @@
|
|
26
26
|
Using your logs shouldn't be a time consuming, frustrating process! If you were like us, it goes
|
27
27
|
something like this:
|
28
28
|
|
29
|
-
>
|
30
|
-
> Why is searching so difficult and time consuming?
|
31
|
-
> should I use? Will they still be human readable?
|
32
|
-
> from 3rd party libraries? Ahhh!!!
|
29
|
+
> I need to centralize my logs, where should I send them? Which provider should I use?
|
30
|
+
> Wow, this is expensive. Why is searching so difficult and time consuming?
|
31
|
+
> Would structuring my logs help? Which format should I use? Will they still be human readable?
|
32
|
+
> What if the structure changes? What about logs from 3rd party libraries? Ahhh!!!
|
33
33
|
|
34
34
|
Timber solves this by providing a complete, managed, end-to-end logging solution that marries
|
35
35
|
a beautiful, *fast*, console with libraries that automatically structure and enrich your logs.
|
@@ -70,7 +70,7 @@ module Timber
|
|
70
70
|
end
|
71
71
|
|
72
72
|
TIMBER_URL = "https://logs.timber.io/frames".freeze
|
73
|
-
CONTENT_TYPE = "application/x-timber-msgpack-frame-1".freeze
|
73
|
+
CONTENT_TYPE = "application/x-timber-msgpack-frame-1; charset=ascii-8bit".freeze
|
74
74
|
USER_AGENT = "Timber Ruby Gem/#{Timber::VERSION}".freeze
|
75
75
|
DELIVERY_FREQUENCY_SECONDS = 2.freeze
|
76
76
|
RETRY_LIMIT = 5.freeze
|
@@ -230,7 +230,7 @@ module Timber
|
|
230
230
|
end
|
231
231
|
|
232
232
|
def authorization_payload
|
233
|
-
@authorization_payload ||= "Basic #{Base64.
|
233
|
+
@authorization_payload ||= "Basic #{Base64.urlsafe_encode64(@api_key).chomp}"
|
234
234
|
end
|
235
235
|
|
236
236
|
def logger
|
data/lib/timber/logger.rb
CHANGED
data/lib/timber/version.rb
CHANGED
@@ -85,19 +85,20 @@ describe Timber::LogDevices::HTTP do
|
|
85
85
|
it "should start a intervaled flush thread and flush on an interval" do
|
86
86
|
stub = stub_request(:post, "https://logs.timber.io/frames").
|
87
87
|
with(
|
88
|
-
:body =>
|
88
|
+
:body => "test log message 1test log message 2",
|
89
89
|
:headers => {
|
90
90
|
'Accept' => 'application/json',
|
91
91
|
'Authorization' => 'Basic TVlLRVk=',
|
92
|
-
'Content-Type' => 'application/x-timber-msgpack-frame-1',
|
92
|
+
'Content-Type' => 'application/x-timber-msgpack-frame-1; charset=ascii-8bit',
|
93
93
|
'User-Agent' => "Timber Ruby Gem/#{Timber::VERSION}"
|
94
94
|
}
|
95
95
|
).
|
96
96
|
to_return(:status => 200, :body => "", :headers => {})
|
97
97
|
|
98
98
|
http = described_class.new("MYKEY", flush_interval: 0.1)
|
99
|
-
http.write("test log message")
|
100
|
-
|
99
|
+
http.write("test log message 1")
|
100
|
+
http.write("test log message 2")
|
101
|
+
sleep 0.3
|
101
102
|
|
102
103
|
expect(stub).to have_been_requested.times(1)
|
103
104
|
end
|
data/spec/timber/logger_spec.rb
CHANGED
@@ -108,4 +108,18 @@ describe Timber::Logger, :rails_23 => true do
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
111
|
+
|
112
|
+
describe described_class::MsgPackFormatter do
|
113
|
+
describe "#call" do
|
114
|
+
let(:time) { Time.utc(2016, 9, 1, 12, 0, 0) }
|
115
|
+
|
116
|
+
it "should produce a message pack formatted message" do
|
117
|
+
formatter = described_class.new
|
118
|
+
result = formatter.call("INFO", time, nil, "this is a test message")
|
119
|
+
hash = {"level"=>"info", "dt"=>"2016-09-01T12:00:00.000000Z", "message"=>"this is a test message"}
|
120
|
+
expected = hash.to_msgpack + "\n"
|
121
|
+
expect(result).to eq(expected)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
111
125
|
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: 1.0.
|
4
|
+
version: 1.0.11
|
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: 2016-12-
|
11
|
+
date: 2016-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|