hatchet 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 62a2f3c316952425c391a021841d57d979113dba
4
+ data.tar.gz: 13ca1b5591f60a6743aedf4726572bb30a9d7541
5
+ SHA512:
6
+ metadata.gz: 2309a896265a9523171a70e222d7effaeca7dca3ad7267632d078fdae10ff750512aa182606f0f65c585883220598b02bedc3c80300deb1d0d0e649b74ca58c7
7
+ data.tar.gz: 3a46326ecc45f8ea4351b589835c34c7faddfa214938ff8088750d5c14ac7cdeb96080fb9a4ac0a18a5dd4f83d34d9883ffa105ab2783d9579d1ed05a442791a
data/RELEASE.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release notes
2
2
 
3
+ ## 0.2.8
4
+
5
+ * Added the ability to limit the number of lines of backtrace included by the
6
+ `BacktraceFormatter`
7
+
3
8
  ## 0.2.7
4
9
 
5
10
  * Hatchet can be marshalled to YAML safely (thanks to
@@ -23,6 +23,12 @@ module Hatchet
23
23
  @backtrace = value
24
24
  end
25
25
 
26
+ # Public: Gets and sets the number of lines to limit backtraces to.
27
+ #
28
+ # If set to nil, the entire backtrace will be used.
29
+ #
30
+ attr_accessor :backtrace_limit
31
+
26
32
  private
27
33
 
28
34
  # Private: Method that takes an already formatted message and appends the
@@ -39,8 +45,14 @@ module Hatchet
39
45
  error = message.error
40
46
 
41
47
  if self.backtrace && error && error.respond_to?(:backtrace)
42
- indented_backtrace = error.backtrace.map { |line| " #{line}" }.to_a
43
- msg = ([msg] + indented_backtrace).join("\n")
48
+ backtrace = if backtrace_limit
49
+ error.backtrace.take(backtrace_limit)
50
+ else
51
+ error.backtrace
52
+ end
53
+
54
+ indented_backtrace = backtrace.map { |line| " #{line}" }.to_a
55
+ msg = indented_backtrace.insert(0, msg).join("\n")
44
56
  end
45
57
 
46
58
  msg
@@ -4,6 +4,6 @@ module Hatchet
4
4
 
5
5
  # Public: The version of Hatchet.
6
6
  #
7
- VERSION = '0.2.7'
7
+ VERSION = '0.2.8'
8
8
 
9
9
  end
@@ -36,6 +36,20 @@ describe SimpleFormatter do
36
36
  foo.rb:20:b}, message
37
37
  end
38
38
 
39
+ describe 'with limited backtrace' do
40
+
41
+ before do
42
+ subject.backtrace_limit = 1
43
+ end
44
+
45
+ it 'outputs the message in the LEVEL - CONTEXT - MESSAGE format' do
46
+ message = subject.format(:info, 'Custom::Context', @message)
47
+ assert_equal %q{INFO - Custom::Context - Hello, World
48
+ foo.rb:1:a}, message
49
+ end
50
+
51
+ end
52
+
39
53
  end
40
54
 
41
55
  describe 'with backtraces disabled' do
metadata CHANGED
@@ -1,28 +1,27 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hatchet
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.8
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Garry Shutler
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2013-09-12 00:00:00 Z
11
+ date: 2014-04-05 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
- description: Logging library that provides the ability to add class/module specific filters
17
- email:
13
+ description: Logging library that provides the ability to add class/module specific
14
+ filters
15
+ email:
18
16
  - garry@robustsoftware.co.uk
19
17
  executables: []
20
-
21
18
  extensions: []
22
-
23
19
  extra_rdoc_files: []
24
-
25
- files:
20
+ files:
21
+ - LICENSE
22
+ - README.md
23
+ - RELEASE.md
24
+ - lib/hatchet.rb
26
25
  - lib/hatchet/backtrace_formatter.rb
27
26
  - lib/hatchet/configuration.rb
28
27
  - lib/hatchet/delegating_formatter.rb
@@ -38,7 +37,6 @@ files:
38
37
  - lib/hatchet/standard_formatter.rb
39
38
  - lib/hatchet/thread_name_formatter.rb
40
39
  - lib/hatchet/version.rb
41
- - lib/hatchet.rb
42
40
  - spec/configuration_spec.rb
43
41
  - spec/helpers/disabled_appender.rb
44
42
  - spec/helpers/failing_appender.rb
@@ -55,43 +53,31 @@ files:
55
53
  - spec/simple_formatter_spec.rb
56
54
  - spec/spec_helper.rb
57
55
  - spec/standard_formatter_spec.rb
58
- - LICENSE
59
- - README.md
60
- - RELEASE.md
61
56
  homepage: http://gshutler.github.com/hatchet/
62
- licenses:
57
+ licenses:
63
58
  - MIT
59
+ metadata: {}
64
60
  post_install_message:
65
61
  rdoc_options: []
66
-
67
- require_paths:
62
+ require_paths:
68
63
  - lib
69
- required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 2082172114613149451
75
- segments:
76
- - 0
77
- version: "0"
78
- required_rubygems_version: !ruby/object:Gem::Requirement
79
- none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- hash: 2082172114613149451
84
- segments:
85
- - 0
86
- version: "0"
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
87
74
  requirements: []
88
-
89
75
  rubyforge_project:
90
- rubygems_version: 1.8.24
76
+ rubygems_version: 2.2.2
91
77
  signing_key:
92
- specification_version: 3
78
+ specification_version: 4
93
79
  summary: Logging library that provides the ability to add class/module specific filters
94
- test_files:
80
+ test_files:
95
81
  - spec/configuration_spec.rb
96
82
  - spec/helpers/disabled_appender.rb
97
83
  - spec/helpers/failing_appender.rb