l2meter 0.9.0 → 0.9.1

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: ca246ee77800547afc00d19c21279922ed64a4d1
4
- data.tar.gz: 6521d7dd5b8ded99ed1de5580681d800fdb67f3f
3
+ metadata.gz: f3673ba178109f4ff153a1e629f77ad8661eb927
4
+ data.tar.gz: '09daa1747e20d54e43cd8002c17e57fb46810ae2'
5
5
  SHA512:
6
- metadata.gz: 656126158ebdc783c4a1d160bf2043bf6d93fe1653e04f13bdea8eac40a6c9366afae7f553a29c1aabbbc711a91a35e8ba25f21490d965b9eb8b746976592480
7
- data.tar.gz: 6b388f5d352734326369b7c7d4ed4210d39f5da503c573a1b7f43976d2c00122acdc860ea0e4965790c688a42f9108bdb05abdc71394d95a28ada18008c4cd53
6
+ metadata.gz: f6bb5ea3300ba4b1dc00d4782d51736b8660f050d207c94c27438d240a9550d06ad6a5f0855fbdc3ecc0372655c00a8329da8b5a8752a838cb6b0dd986cd70e9
7
+ data.tar.gz: b3cb2ba31ce943f33de1d030aced621bd6c2dfe9ff02855e3136aedd5cc579ccd44193447605e6c886798905a024395431ba72bf5953644d9468dbfddf2dce91
data/README.md CHANGED
@@ -88,7 +88,7 @@ end
88
88
  ## Contexted logging
89
89
 
90
90
  Sometimes you want another copy of the logger with a specific context on it.
91
- You can created one like so:
91
+ You can create one like so:
92
92
 
93
93
  ```ruby
94
94
  logger = Metrics.context(:super_worker, username: "joe")
@@ -231,9 +231,9 @@ RSpec.configure do |config|
231
231
  end
232
232
  ```
233
233
 
234
- Note that this code will only silence logger in the current thread. It'll
235
- still produce ouput if you fire up a new thread. To silence it completely,
236
- use `disable!` method, like so:
234
+ Note that this code will only silence logger in the current thread. It'll still
235
+ produce output if you fire up a new thread. To silence it completely, use
236
+ `disable!` method, like so:
237
237
 
238
238
  ```ruby
239
239
  # spec/spec_helper.rb
@@ -98,7 +98,7 @@ module L2meter
98
98
 
99
99
  tokens.sort! if configuration.sort?
100
100
 
101
- output_queue.last.print [*tokens].join(" ") + "\n" if tokens.any?
101
+ output_queue.last.print tokens.join(SPACE) << NL if tokens.any?
102
102
  ensure
103
103
  @buffer.clear
104
104
  end
@@ -111,6 +111,11 @@ module L2meter
111
111
 
112
112
  private
113
113
 
114
+ SPACE = " ".freeze
115
+ NL = "\n".freeze
116
+
117
+ private_constant :SPACE, :NL
118
+
114
119
  def unwrap(args)
115
120
  args.each_with_object({}) do |context, result|
116
121
  next if context.nil?
@@ -185,7 +190,10 @@ module L2meter
185
190
  result = yield
186
191
  merge! params, at: :finish
187
192
  rescue Object => exception
188
- merge! params, at: :exception, exception: exception.class, message: exception.message
193
+ merge! params, \
194
+ at: :exception,
195
+ exception: exception.class,
196
+ message: exception.message
189
197
  end
190
198
 
191
199
  write elapsed_context(start_time)
@@ -208,7 +216,7 @@ module L2meter
208
216
  end
209
217
 
210
218
  def elapsed_context(since = Time.now)
211
- { elapsed: -> { elapsed_value(since) }}
219
+ { elapsed: -> { elapsed_value(since) } }
212
220
  end
213
221
 
214
222
  def elapsed_value(since)
@@ -8,31 +8,26 @@ module L2meter
8
8
  class ThreadSafe
9
9
  extend Forwardable
10
10
 
11
- EMITTER_METHODS = %i[
12
- batch
13
- configuration
14
- count
15
- fire!
16
- log
17
- measure
18
- merge!
19
- push_context
20
- sample
21
- silence
22
- silence!
23
- unique
24
- unsilence!
25
- with_elapsed
26
- with_output
27
- ]
28
-
29
- private_constant :EMITTER_METHODS
30
-
31
11
  def initialize(emitter)
32
12
  @emitter = emitter.freeze
33
13
  end
34
14
 
35
- def_delegators :receiver, *EMITTER_METHODS
15
+ def_delegators :receiver, \
16
+ :batch,
17
+ :configuration,
18
+ :count,
19
+ :fire!,
20
+ :log,
21
+ :measure,
22
+ :merge!,
23
+ :push_context,
24
+ :sample,
25
+ :silence,
26
+ :silence!,
27
+ :unique,
28
+ :unsilence!,
29
+ :with_elapsed,
30
+ :with_output
36
31
 
37
32
  def context(*args, &block)
38
33
  value = current_emitter.context(*args, &block)
@@ -1,3 +1,3 @@
1
1
  module L2meter
2
- VERSION = "0.9.0".freeze
2
+ VERSION = "0.9.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: l2meter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pravosud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-12 00:00:00.000000000 Z
11
+ date: 2017-03-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project:
48
- rubygems_version: 2.6.8
48
+ rubygems_version: 2.6.10
49
49
  signing_key:
50
50
  specification_version: 4
51
51
  summary: L2met friendly log formatter