timber 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timber/events/exception.rb +14 -3
- data/lib/timber/version.rb +1 -1
- data/spec/timber/events/exception_spec.rb +19 -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: a6efcc9b1ff96b7bfea713d3e87e36b7bfc061fd
|
4
|
+
data.tar.gz: 6ef8b32449171a85062421fc42da7c4417b7fdf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79c590f521790d5f24349bdfb2cd9058cd78b18955bfa61164338d75b70cb7e58a24594a31f93780af6a1f27bbafd124c5a3249d3dac9d331debfb3181792e63
|
7
|
+
data.tar.gz: 6e284e8801b5e9643fe36e65200f1425c2da8ab078a6bb60f29339323da86ef371f7ca8a32634f8f7d22932672422e35bc4883e59f814ae06d131503a08ec076
|
@@ -41,9 +41,20 @@ module Timber
|
|
41
41
|
def parse_backtrace_line(line)
|
42
42
|
# using split for performance reasons
|
43
43
|
file, line, function_part = line.split(":", 3)
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
|
45
|
+
parsed_line = {file: file}
|
46
|
+
|
47
|
+
if line
|
48
|
+
parsed_line[:line] = line.to_i
|
49
|
+
end
|
50
|
+
|
51
|
+
if function_part
|
52
|
+
_prefix, function_pre = function_part.split("`", 2)
|
53
|
+
function = Util::Object.try(function_pre, :chomp, "'")
|
54
|
+
parsed_line[:function] = function
|
55
|
+
end
|
56
|
+
|
57
|
+
parsed_line
|
47
58
|
end
|
48
59
|
end
|
49
60
|
end
|
data/lib/timber/version.rb
CHANGED
@@ -11,5 +11,24 @@ describe Timber::Events::Exception, :rails_23 => true do
|
|
11
11
|
exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace)
|
12
12
|
expect(exception_event.backtrace).to eq([{:file=>"/path/to/file1.rb", :line=>26, :function=>"function1"}, {:file=>"path/to/file2.rb", :line=>86, :function=>"function2"}])
|
13
13
|
end
|
14
|
+
|
15
|
+
it "parses valid lines" do
|
16
|
+
backtrace = [
|
17
|
+
"/path/to/file1.rb:26:in `function1'",
|
18
|
+
"path/to/file2.rb:86" # function names are optional
|
19
|
+
]
|
20
|
+
|
21
|
+
exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace)
|
22
|
+
expect(exception_event.backtrace).to eq([{:file=>"/path/to/file1.rb", :line=>26, :function=>"function1"}, {:file=>"path/to/file2.rb", :line=>86}])
|
23
|
+
end
|
24
|
+
|
25
|
+
it "handles malformed lines" do
|
26
|
+
backtrace = [
|
27
|
+
"malformed"
|
28
|
+
]
|
29
|
+
|
30
|
+
exception_event = described_class.new(name: "RuntimeError", exception_message: "Boom", backtrace: backtrace)
|
31
|
+
expect(exception_event.backtrace).to eq([{:file=>"malformed"}])
|
32
|
+
end
|
14
33
|
end
|
15
34
|
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.1.
|
4
|
+
version: 2.1.1
|
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: 2017-06-
|
11
|
+
date: 2017-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|