tracee 1.0.21 → 1.0.23

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c576fa8d39afe4fd20d6bd8bd6086c017675449
4
- data.tar.gz: 51940afeb97ead1889de574564ca155d8b5f21c6
3
+ metadata.gz: 637958bdfbed8bf417884a99c00948b4543b379e
4
+ data.tar.gz: 56cabb7bb3afc959fe14a5d0b88eedc38af5f17c
5
5
  SHA512:
6
- metadata.gz: 799088d59b979a70f904e749b1bdd5469606dca1e7887054c99b76630827726d5f009b6f16d6342a8fb78733eeb03d2c31370e253253dab8e5bf34a7b571e5a1
7
- data.tar.gz: 1b618f33803bdd64120a47eaaf03b7f9935677397cab45ff0cbcef6a8e53b3ca015ce86645a2685f5e6c3ec8929b89ae2c584a0094793d624bc977e1c94d8321
6
+ metadata.gz: 7b2621cd13bd53a06d69c69835f0b5c7989349339b9aae1b1ae1901811c23e8944c8543f709e733efa05ae3bc8f900ca2f16e40709828e5e8e8ec40c0f80bc1a
7
+ data.tar.gz: 6b87deb90244cc477afb4c34edf3e688a5e9d79905dbca0e74c11310df139ad2421e53413c8372dcc0710bde046132d39bbf461bae25d0513176ee717366a2c5
@@ -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
- # Check if it's not the version that always freezes on error with the trace decorator.
65
- if RUBY_VERSION <= '2.3.1'
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
@@ -6,46 +6,49 @@ module Tracee
6
6
  exc_class.send :class_attribute, :trace_decorator
7
7
  end
8
8
 
9
- ## Gotcha:
10
- # If you also set (e.g. in irbrc file)
11
- #
12
- # SCRIPT_LINES__['(irb)'] = []
13
- # module Readline
14
- # alias :orig_readline :readline
15
- # def readline(*args)
16
- # ln = orig_readline(*args)
17
- # SCRIPT_LINES__['(irb)'] << "#{ln}\n"
18
- # ln
19
- # end
20
- # end
21
- #
22
- # it will be possible to fetch lines entered in IRB
23
- # else format_trace would only read ordinary require'd files
24
- ##
25
- if RUBY_VERSION > '2.1'
26
-
27
- def set_backtrace(trace)
28
- if decorator = self.class.trace_decorator
29
- if trace.is_a? Thread::Backtrace
30
- return trace
31
- else
32
- trace = decorator.(trace)
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
- super(trace)
37
- end
38
-
39
- else
40
-
41
- def set_backtrace(trace)
42
- if decorator = self.class.trace_decorator
43
- trace = decorator.(trace)
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(backtrace)
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>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) at (?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?: \+\d{4})?)}
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]+)$}
@@ -1,3 +1,3 @@
1
1
  module Tracee
2
- VERSION = '1.0.21'
2
+ VERSION = '1.0.23'
3
3
  end
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.21
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-05-30 00:00:00.000000000 Z
11
+ date: 2018-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler