pliny 0.24.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pliny/error_reporters/rollbar.rb +1 -1
- data/lib/pliny/log.rb +4 -0
- data/lib/pliny/version.rb +1 -1
- data/lib/template/.ruby-version +1 -1
- data/lib/template/Gemfile +2 -2
- data/lib/template/lib/routes.rb +1 -1
- data/spec/error_reporters/rollbar_spec.rb +5 -4
- data/spec/log_spec.rb +7 -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: fc58fa1c7528a90b019d6f7d01dcb733909c918d
|
4
|
+
data.tar.gz: ed596145f95be0ff622f9cdcf2e6a5448a96a56e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 300c529e268a5e168dd015a42d3a1a68b3fceaf6359c47ca8288aa6e08cfcf222f029a0cb0f6541c160ad000951ebb607144c4191eecaa981b75fbbe75cd2679
|
7
|
+
data.tar.gz: ad0e7f83fdd78ccd9c97c2fcdf296b17c842874cf9e372e592a666072b0361cf9a1e4a1aebdda921130115b5420e03623ea472ebcb24946ffafd4ed17a9c33d8
|
data/lib/pliny/log.rb
CHANGED
@@ -4,6 +4,10 @@ module Pliny
|
|
4
4
|
log_to_stream(stdout || $stdout, merge_log_contexts(data), &block)
|
5
5
|
end
|
6
6
|
|
7
|
+
def log_with_default_context(data, &block)
|
8
|
+
log_to_stream(stdout || $stdout, default_context.merge(data), &block)
|
9
|
+
end
|
10
|
+
|
7
11
|
def log_without_context(data, &block)
|
8
12
|
log_to_stream(stdout || $stdout, data, &block)
|
9
13
|
end
|
data/lib/pliny/version.rb
CHANGED
data/lib/template/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.0
|
data/lib/template/Gemfile
CHANGED
data/lib/template/lib/routes.rb
CHANGED
@@ -6,7 +6,7 @@ Routes = Rack::Builder.new do
|
|
6
6
|
use Pliny::Middleware::Metrics
|
7
7
|
use Pliny::Middleware::CanonicalLogLine,
|
8
8
|
emitter: -> (data) {
|
9
|
-
Pliny.
|
9
|
+
Pliny.log_with_default_context({ canonical_log_line: true }.merge(data))
|
10
10
|
}
|
11
11
|
use Pliny::Middleware::RescueErrors, raise: Config.raise_errors?
|
12
12
|
if Config.timeout.positive?
|
@@ -7,7 +7,7 @@ describe Pliny::ErrorReporters::Rollbar do
|
|
7
7
|
|
8
8
|
describe "#notify" do
|
9
9
|
let(:exception) { StandardError.new("Something went wrong") }
|
10
|
-
let(:context) { {} }
|
10
|
+
let(:context) { { step: :foo } }
|
11
11
|
let(:rack_env) { { "rack.input" => StringIO.new } }
|
12
12
|
|
13
13
|
subject(:notify) do
|
@@ -28,7 +28,8 @@ describe Pliny::ErrorReporters::Rollbar do
|
|
28
28
|
it "scopes the rollbar notification" do
|
29
29
|
notify
|
30
30
|
expect(::Rollbar).to have_received(:scoped).once.with(hash_including(
|
31
|
-
request: instance_of(Proc)
|
31
|
+
request: instance_of(Proc),
|
32
|
+
custom: { step: :foo }
|
32
33
|
))
|
33
34
|
end
|
34
35
|
|
@@ -45,9 +46,9 @@ describe Pliny::ErrorReporters::Rollbar do
|
|
45
46
|
assert_kind_of(Hash, rack_env)
|
46
47
|
end
|
47
48
|
|
48
|
-
it "reports to Rollbar
|
49
|
+
it "reports to Rollbar without request data in the scope" do
|
49
50
|
notify
|
50
|
-
expect(Rollbar).to have_received(:scoped).once.with({})
|
51
|
+
expect(Rollbar).to have_received(:scoped).once.with({ custom: {step: :foo} })
|
51
52
|
end
|
52
53
|
|
53
54
|
it "delegates to #report_exception_to_rollbar" do
|
data/spec/log_spec.rb
CHANGED
@@ -38,6 +38,13 @@ describe Pliny::Log do
|
|
38
38
|
Pliny.log(foo: "bar")
|
39
39
|
end
|
40
40
|
|
41
|
+
it "logs with just default context" do
|
42
|
+
Pliny.default_context = { app: "pliny" }
|
43
|
+
Pliny::RequestStore.store[:log_context] = { request_store: true }
|
44
|
+
expect(@io).to receive(:print).with("app=pliny foo=bar\n")
|
45
|
+
Pliny.log_with_default_context(foo: "bar")
|
46
|
+
end
|
47
|
+
|
41
48
|
it "logs without context" do
|
42
49
|
Pliny.default_context = { app: "pliny" }
|
43
50
|
expect(@io).to receive(:print).with("foo=bar\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pliny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur Leach
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|