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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83d5df35d9fd7a86960281bf683f97419a55eacc
4
- data.tar.gz: 16d1c2a21d07bf6d9c05a750d24cc48c1564b2cd
3
+ metadata.gz: d077443fc6d81d17024ca768f807d246ae550741
4
+ data.tar.gz: ad06e2613fa515befaf240c91ed03329f75dd432
5
5
  SHA512:
6
- metadata.gz: f98ccb6cbbc9a0ff0fac089c21d9859196c9fa9e482c025d96f2b05020a6e5874617ea226788fef37b3cec028eb3bc3a806ead914d394d83b4fb8d8b3145f570
7
- data.tar.gz: b687cc08f4356127f654d727a4ee1f824bb1e41b0c3818f515b526bb7b635ad9b83d678c645b509788a7a488706ecbb84918d43ac8581498f9f38fec84c000c1
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
- > How do I access my logs? Which provider should I use? Why is it so expensive?
30
- > Why is searching so difficult and time consuming? Should I structure my logs? Which format
31
- > should I use? Will they still be human readable? What if the structure changes? What about logs
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.strict_encode64(@api_key).chomp}"
233
+ @authorization_payload ||= "Basic #{Base64.urlsafe_encode64(@api_key).chomp}"
234
234
  end
235
235
 
236
236
  def logger
@@ -140,7 +140,8 @@ module Timber
140
140
  begin
141
141
  msg.to_msgpack
142
142
  rescue NoMethodError
143
- JSON.parse(JSON.generate(msg)).to_msgpack
143
+ json = JSON.generate(msg)
144
+ JSON.parse(json).to_msgpack
144
145
  end
145
146
  end
146
147
  end
@@ -1,3 +1,3 @@
1
1
  module Timber
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.11"
3
3
  end
@@ -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 => 'test log message',
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
- sleep 0.2
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
@@ -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.10
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-19 00:00:00.000000000 Z
11
+ date: 2016-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack