madvertise-logging 0.9.0 → 0.9.1

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.
@@ -0,0 +1,20 @@
1
+ require 'airbrake'
2
+
3
+ module Madvertise
4
+ module Logging
5
+ class ImprovedLogger
6
+ # Log an exception with airbrake.
7
+ #
8
+ # @param [Exception] exc The exception to log.
9
+ # @param [String] message Additional reason to log.
10
+ def exception(exc, message = nil, attribs = {})
11
+ Airbrake.notify_or_ignore(exc, attribs.merge({
12
+ error_class: exc.class,
13
+ error_message: message,
14
+ reason: exc.message,
15
+ backtrace: clean_trace(exc.backtrace)
16
+ }))
17
+ end
18
+ end
19
+ end
20
+ end
@@ -156,13 +156,13 @@ module Madvertise
156
156
  #
157
157
  # @param [Exception] exc The exception to log.
158
158
  # @param [String] message Additional reason to log.
159
- def exception(exc, message=nil)
160
- fatal("exception", {
159
+ def exception(exc, message = nil, attribs = {})
160
+ fatal("exception", attribs.merge({
161
161
  class: exc.class,
162
162
  reason: exc.message,
163
163
  message: message,
164
164
  backtrace: clean_trace(exc.backtrace)
165
- })
165
+ }))
166
166
  end
167
167
 
168
168
  # Log a realtime benchmark
@@ -218,6 +218,7 @@ module Madvertise
218
218
  #
219
219
  # @private
220
220
  def clean_trace(trace)
221
+ return unless trace
221
222
  trace.reject do |line|
222
223
  line =~ /(gems|vendor)\/madvertise-logging/
223
224
  end
@@ -1,6 +1,6 @@
1
1
  module Madvertise
2
2
  module Logging
3
3
  # @private
4
- VERSION = "0.9.0"
4
+ VERSION = "0.9.1"
5
5
  end
6
6
  end
@@ -316,7 +316,7 @@ describe ImprovedLogger do
316
316
 
317
317
  @expected = {
318
318
  severity: Logger::INFO,
319
- time: @now,
319
+ time: @now.to_f,
320
320
  progname: "rspec",
321
321
  message: @msg
322
322
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madvertise-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-10 00:00:00.000000000 Z
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Advanced logging classes with buffer backend, transactions, multi logger,
15
15
  etc
@@ -29,6 +29,7 @@ files:
29
29
  - Rakefile
30
30
  - benchmark.rb
31
31
  - lib/madvertise-logging.rb
32
+ - lib/madvertise/logging/airbrake.rb
32
33
  - lib/madvertise/logging/document_logger.rb
33
34
  - lib/madvertise/logging/improved_io.rb
34
35
  - lib/madvertise/logging/improved_logger.rb
@@ -57,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
58
  version: '0'
58
59
  segments:
59
60
  - 0
60
- hash: 3785636085550773835
61
+ hash: 2758512505850548801
61
62
  required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  none: false
63
64
  requirements:
@@ -66,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
67
  version: '0'
67
68
  segments:
68
69
  - 0
69
- hash: 3785636085550773835
70
+ hash: 2758512505850548801
70
71
  requirements: []
71
72
  rubyforge_project:
72
73
  rubygems_version: 1.8.24