madvertise-logging 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use --create ruby-1.9.3-p125@madvertise-logging
1
+ rvm use --create ruby-1.9.3-p286@madvertise-logging
@@ -1,5 +1,6 @@
1
1
  require 'logger'
2
2
  require 'stringio'
3
+ require 'benchmark'
3
4
 
4
5
  require 'madvertise/logging/improved_io'
5
6
 
@@ -123,9 +124,14 @@ module Madvertise
123
124
  add(:#{severity}, *args)
124
125
  end
125
126
  end
127
+
128
+ def #{severity}?
129
+ true
130
+ end
126
131
  EOM
127
132
  else
128
133
  instance_eval("def #{severity}(*args); end", __FILE__, __LINE__)
134
+ instance_eval("def #{severity}?; false; end", __FILE__, __LINE__)
129
135
  end
130
136
  end
131
137
  end
@@ -151,7 +157,18 @@ module Madvertise
151
157
  })
152
158
  end
153
159
 
154
- def add(severity, message, attribs={})
160
+ # Log a realtime benchmark
161
+ #
162
+ # @param [String] msg The log message
163
+ # @param [String,Symbol] key The realtime key
164
+ def realtime(severity, msg, attribs = {}, &block)
165
+ result = nil
166
+ rt = Benchmark.realtime { result = yield }
167
+ add(severity, msg, attribs.merge({rt: rt}))
168
+ return result
169
+ end
170
+
171
+ def add(severity, message, attribs = {})
155
172
  severity = severity.is_a?(Symbol) ? self.class.severities[severity] : severity
156
173
  message = "#{called_from}: #{message}" if @log_caller
157
174
  message = "[#{@token}] #{message}" if @token
@@ -1,6 +1,6 @@
1
1
  module Madvertise
2
2
  module Logging
3
3
  # @private
4
- VERSION = "0.7.2"
4
+ VERSION = "0.7.3"
5
5
  end
6
6
  end
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.7.2
4
+ version: 0.7.3
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: 2012-10-19 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Advanced logging classes with buffer backend, transactions, multi logger,
15
15
  etc
@@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  segments:
58
58
  - 0
59
- hash: -539990701144996843
59
+ hash: 2068495888823290885
60
60
  required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
@@ -65,10 +65,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  version: '0'
66
66
  segments:
67
67
  - 0
68
- hash: -539990701144996843
68
+ hash: 2068495888823290885
69
69
  requirements: []
70
70
  rubyforge_project:
71
- rubygems_version: 1.8.17
71
+ rubygems_version: 1.8.24
72
72
  signing_key:
73
73
  specification_version: 3
74
74
  summary: Advanced logging classes with buffer backend, transactions, multi logger,