tracee 1.0.21 → 1.0.23
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/lib/tracee.rb +3 -7
- data/lib/tracee/ext/exception.rb +42 -35
- data/lib/tracee/preprocessors/colorize.rb +1 -1
- data/lib/tracee/version.rb +1 -1
- 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: 637958bdfbed8bf417884a99c00948b4543b379e
|
4
|
+
data.tar.gz: 56cabb7bb3afc959fe14a5d0b88eedc38af5f17c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b2621cd13bd53a06d69c69835f0b5c7989349339b9aae1b1ae1901811c23e8944c8543f709e733efa05ae3bc8f900ca2f16e40709828e5e8e8ec40c0f80bc1a
|
7
|
+
data.tar.gz: 6b87deb90244cc477afb4c34edf3e688a5e9d79905dbca0e74c11310df139ad2421e53413c8372dcc0710bde046132d39bbf461bae25d0513176ee717366a2c5
|
data/lib/tracee.rb
CHANGED
@@ -61,11 +61,8 @@ module Tracee
|
|
61
61
|
# without side-effects, so we just skip extending.
|
62
62
|
else
|
63
63
|
# BetterErrors has not yet been loaded or will not be loaded at all.
|
64
|
-
#
|
65
|
-
|
66
|
-
# Just insert the extension before Exception.
|
67
|
-
::Exception.prepend Tracee::Extensions::Exception
|
68
|
-
end
|
64
|
+
# Just insert the extension before Exception.
|
65
|
+
::Exception.prepend Tracee::Extensions::Exception
|
69
66
|
end
|
70
67
|
::Exception.send :class_attribute, :trace_decorator
|
71
68
|
|
@@ -114,6 +111,5 @@ module Tracee
|
|
114
111
|
|
115
112
|
end
|
116
113
|
|
117
|
-
|
118
|
-
$log ||= Logger.new
|
114
|
+
Logger.new default: true
|
119
115
|
end
|
data/lib/tracee/ext/exception.rb
CHANGED
@@ -6,46 +6,49 @@ module Tracee
|
|
6
6
|
exc_class.send :class_attribute, :trace_decorator
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
9
|
+
# Check if it's not the version that always freezes on error with the trace decorator.
|
10
|
+
if RUBY_VERSION <= '2.3.1'
|
11
|
+
## Gotcha:
|
12
|
+
# If you also set (e.g. in irbrc file)
|
13
|
+
#
|
14
|
+
# SCRIPT_LINES__['(irb)'] = []
|
15
|
+
# module Readline
|
16
|
+
# alias :orig_readline :readline
|
17
|
+
# def readline(*args)
|
18
|
+
# ln = orig_readline(*args)
|
19
|
+
# SCRIPT_LINES__['(irb)'] << "#{ln}\n"
|
20
|
+
# ln
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# it will be possible to fetch lines entered in IRB
|
25
|
+
# else format_trace would only read ordinary require'd files
|
26
|
+
##
|
27
|
+
if RUBY_VERSION > '2.1.0'
|
28
|
+
|
29
|
+
def set_backtrace(trace)
|
30
|
+
if decorator = self.class.trace_decorator
|
31
|
+
if trace.is_a? Thread::Backtrace
|
32
|
+
return trace
|
33
|
+
else
|
34
|
+
trace = decorator.(trace)
|
35
|
+
end
|
33
36
|
end
|
37
|
+
|
38
|
+
super(trace)
|
34
39
|
end
|
35
40
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
else
|
42
|
+
|
43
|
+
def set_backtrace(trace)
|
44
|
+
if decorator = self.class.trace_decorator
|
45
|
+
trace = decorator.(trace)
|
46
|
+
end
|
47
|
+
|
48
|
+
super(trace)
|
44
49
|
end
|
45
50
|
|
46
|
-
super(trace)
|
47
51
|
end
|
48
|
-
|
49
52
|
end
|
50
53
|
|
51
54
|
## Use case:
|
@@ -60,9 +63,13 @@ module Tracee
|
|
60
63
|
def log
|
61
64
|
Rails.logger.error [
|
62
65
|
"The exception has been handled: #{self.class} — #{message.force_encoding('UTF-8')}:",
|
63
|
-
*Rails.backtrace_cleaner.clean(
|
66
|
+
*Rails.backtrace_cleaner.clean(backtrace_with_cause_backtrace)
|
64
67
|
]*"\n"
|
65
68
|
end
|
69
|
+
|
70
|
+
def backtrace_with_cause_backtrace
|
71
|
+
backtrace + (cause ? ["+ cause (#{cause.class}) backtrace", *cause.backtrace_with_cause_backtrace] : [])
|
72
|
+
end
|
66
73
|
|
67
74
|
end
|
68
75
|
end
|
@@ -21,7 +21,7 @@ module Tracee::Preprocessors
|
|
21
21
|
|
22
22
|
def call(msg_level, datetime, progname, msg, caller_slice=[])
|
23
23
|
case msg
|
24
|
-
when %r{^Started (?<method>[A-Z]+) "(?<path>/[^"]*)" for (?<ip
|
24
|
+
when %r{^Started (?<method>[A-Z]+) "(?<path>/[^"]*)" for (?<ip>(?:[\d\.]+|[\da-f:]+)) at (?<time>[\d\-]+ [\d:]+(?: \+\d{4})?)}
|
25
25
|
m = $~
|
26
26
|
%{Started #{m[:method].send @color_map[:head]} "#{m[:path].send @color_map[:head]}" for #{m[:ip].send @color_map[:head]} at #{m[:time].send @color_map[:head]}}
|
27
27
|
when %r{^Processing by (?<class>[A-Z][\w:]+)#(?<method>\w+) as (?<format>[A-Z]+)$}
|
data/lib/tracee/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Baev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|