tracee 1.0.2 → 1.0.3

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: e2f91a6aa21495957f1a44cdfaa193ff8245408d
4
- data.tar.gz: 7106c43291029ab1ee9dc5aea7769cd373026e0b
3
+ metadata.gz: e6403fb5162c40596250fb9cf77dda63f9e2bd8a
4
+ data.tar.gz: 8775a62e62078456a7f7d15aa75bce55759d093c
5
5
  SHA512:
6
- metadata.gz: ab74facc10b25ccf817782512c185a1d9154c2a013037233379c254fc3e4348e4d5deb21df8f29282eac7519d6f700892bee1552035adb5f6d2bae85c010a065
7
- data.tar.gz: 6681289066e84565aa331c57d3a580271cd528817c76af11987b1814ab6b8bd94d36d85d962376443e11fa634408e2a9e130c741905dc88b660eef20a095fd81
6
+ metadata.gz: f08b78be1dab246140d956ec84c175014440a45eefa41abf61c11c3ad12ff11b69dba687c1297e8d7ddd2f50129c6b9700ff1dab459e0afa4c271c0f008937a5
7
+ data.tar.gz: ec1c9f06abac8daf7c9e47ad5fb7f258969471cd0abb946be52d959abb060ff2562d1eb6afaaee7787b30c333c23b6b768bcadf46633004bb121d7e1979ebb0e
data/README.md CHANGED
@@ -96,6 +96,12 @@ $log = Tracee::Logger.new(
96
96
  )
97
97
  ```
98
98
 
99
+ #### Usage with Heroku
100
+
101
+ Since Heroku filesystem is [ephemeral](https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem), file output has little sense there and `log/` folder is not initialized by default.
102
+
103
+ If you deploy to Heroku, make sure in your production Rails environment Tracee::Logger is initialized with `streams: [$stdout]` to not run into weird issues.
104
+
99
105
  ### Preprocessors
100
106
 
101
107
  A preprocessor is a callable object which inherits from `Tracee::Preprocessors::Base` and implements a #call method with 5 arguments:
@@ -257,6 +263,13 @@ RuntimeError: It has appeared too wet!
257
263
  ```
258
264
 
259
265
  This feature is integrated with BetterErrors and ActiveSupport::BacktraceCleaner to format a trace of exceptions that would be raised within Rails server environment before send it to a logger.
266
+ Though, in order to use trace decorator with BetterErrors, Tracee must be loaded prior to BetterErrors,
267
+ e.g. in Gemfile
268
+
269
+ ```ruby
270
+ gem 'better_errors', require: ['tracee', 'better_errors']
271
+ ```
272
+
260
273
  To enable it in a console, put
261
274
 
262
275
  ```ruby
@@ -9,18 +9,22 @@ module Tracee
9
9
  end
10
10
 
11
11
  def log_exception_with_decorate
12
- return unless ::BetterErrors.logger
12
+ return unless logger = ::BetterErrors.logger
13
13
 
14
14
  message = "\n#{@error_page.exception.class} - #{@error_page.exception.message}:\n"
15
+
16
+ logger.fatal message
15
17
 
16
18
  frames = @error_page.backtrace_frames # original definition
17
19
  frames = frames.map(&:to_s).reject {|line| line =~ IGNORE_RE}
18
20
  frames = Stack::BaseDecorator.(frames)
19
21
  frames.each do |frame|
20
- message << " #{frame}\n"
22
+ if frame =~ /[-\w]+ \(\d+\.[\w\.]+\) /
23
+ logger.debug " #{frame}"
24
+ else
25
+ logger.fatal " #{frame}"
26
+ end
21
27
  end
22
-
23
- ::BetterErrors.logger.fatal message
24
28
  end
25
29
 
26
30
  end
@@ -1,3 +1,3 @@
1
1
  module Tracee
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/lib/tracee.rb CHANGED
@@ -43,22 +43,17 @@ module Tracee
43
43
  }|/rubygems/core_ext/kernel_require.rb#{ # `require' override
44
44
  }}
45
45
 
46
-
46
+ # In order to use Tracee's trace decorator with BetterErrors, Tracee must be loaded prior to BetterErrros.
47
47
  if defined? ::BetterErrors::ExceptionExtension
48
- # BetterErrors has been loaded
49
- # Insert our extension in between BetterErrors::ExceptionExtension and Exception
50
- module ::BetterErrors::ExceptionExtension
51
- include Tracee::Extensions::Exception
52
- end
53
- ::Exception.send :class_attribute, :trace_decorator
48
+ # BetterErrors was loaded and BetterErrors::ExceptionExtension was prepended to Exception.
49
+ # There is no way to seamlessly use another extension in between them
50
+ # without side-effects, so we just skip extending.
54
51
  else
55
- # BetterErrors has not yet been loaded or will not be loaded at all
56
- # Just insert our extension before Exception
57
- class ::Exception
58
- prepend Tracee::Extensions::Exception
59
- class_attribute :trace_decorator
60
- end
52
+ # BetterErrors has not yet been loaded or will not be loaded at all.
53
+ # Just insert the extension before Exception.
54
+ ::Exception.prepend Tracee::Extensions::Exception
61
55
  end
56
+ ::Exception.send :class_attribute, :trace_decorator
62
57
 
63
58
 
64
59
  module ::ActiveSupport::TaggedLogging::Formatter
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Baev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler