l2meter 0.10.0 → 0.11.0

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: b8abd7703829d8b981631fd16b5fa6f30daea752
4
- data.tar.gz: e539765cd1db9d19045a60ff6f437de738e8722d
3
+ metadata.gz: e11fd798f796a3a70084ef2989c0f3d233d55d7f
4
+ data.tar.gz: 57141bec2eaee516c4913432720d653f52c3009a
5
5
  SHA512:
6
- metadata.gz: 7270713f3b643b674b9bfb6f5c9d3cceb1ba5f72893331314c8f2119f773ccbd708bade4fefc7434d7ca6c38161e718c50ff4b944f5539d28065ccd43c9cffdd
7
- data.tar.gz: d4578d786d1518b2b7a8e226be63426006f85cd91a96975a309dfae900b451b361c4df52eeb85362165b8a8daad2ffa4d391bd2272e99bcabed1ddab18dbc537
6
+ metadata.gz: 7f0b4f401895a9b09705d488b96451e8f965d862f24f60255a4db401d2ef0f8b87dc45b960815cd3c64878c28cf63fcbdd43c4124e714e0ef39ccd3876417a51
7
+ data.tar.gz: ff395e97f4c500d9bd3cada7b0e4ed68af6ae1d8f23eb1bacc16c58217b6cabd197d185b6c3950042e2f254344c7f917bcbe0322a2307a9526d3c916cb77e91e
data/README.md CHANGED
@@ -33,7 +33,7 @@ like so:
33
33
  Metrics.log :doing_work do # => doing-work at=start
34
34
  do_some_work #
35
35
  Metrics.log :work_done # => work-done
36
- end # => doing-work at=finish elapsed=1.2345s
36
+ end # => doing-work at=finish elapsed=1.2345
37
37
  ```
38
38
 
39
39
  In case the exception is raised inside the block, l2meter will report is like
@@ -43,7 +43,7 @@ so:
43
43
  Metrics.log :doing_work do # => doing-work at=start
44
44
  raise ArgumentError, \ #
45
45
  "something is wrong" #
46
- end # => doing-work at=exception exception=ArgumentError message="something is wrong" elapsed=1.2345s
46
+ end # => doing-work at=exception exception=ArgumentError message="something is wrong" elapsed=1.2345
47
47
  ```
48
48
 
49
49
  ## Context
@@ -131,9 +131,9 @@ L2meter also allows to append elapsed time to your log messages automatically.
131
131
  ```ruby
132
132
  Metrics.with_elapsed do
133
133
  do_work_step_1
134
- Metrics.log :step_1_done # => step-1-done elapsed=1.2345s
134
+ Metrics.log :step_1_done # => step-1-done elapsed=1.2345
135
135
  do_work_step_2
136
- Metrics.log :step_2_done # => step-2-done elapsed=2.3456s
136
+ Metrics.log :step_2_done # => step-2-done elapsed=2.3456
137
137
  end
138
138
  ```
139
139
 
@@ -71,8 +71,10 @@ module L2meter
71
71
 
72
72
  def clone
73
73
  cloned_contexts = @contexts.clone
74
+ cloned_outputs = @outputs.clone
74
75
  self.class.new(configuration: configuration).instance_eval do
75
76
  @contexts = cloned_contexts
77
+ @outputs = cloned_outputs
76
78
  self
77
79
  end
78
80
  end
@@ -217,11 +219,7 @@ module L2meter
217
219
  end
218
220
 
219
221
  def elapsed_context(since = Time.now)
220
- { elapsed: -> { elapsed_value(since) } }
221
- end
222
-
223
- def elapsed_value(since)
224
- format_float(Time.now - since, unit: ?s)
222
+ { elapsed: -> { Time.now - since } }
225
223
  end
226
224
 
227
225
  def scrub_value(key, value)
@@ -1,12 +1,11 @@
1
1
  module L2meter
2
2
  class NullObject
3
- # Silence forwardable stdlib warnings about forwarding private metods.
4
- def log(*)
5
- super
3
+ Emitter.instance_methods(false).each do |method_name|
4
+ define_method method_name do |*, &block|
5
+ block && block.call
6
+ end
6
7
  end
7
8
 
8
- def method_missing(*)
9
- yield if block_given?
10
- end
9
+ def print(*); end
11
10
  end
12
11
  end
@@ -12,22 +12,7 @@ module L2meter
12
12
  @emitter = emitter.freeze
13
13
  end
14
14
 
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
15
+ def_delegators :receiver, *Emitter.instance_methods(false)
31
16
 
32
17
  def context(*args, &block)
33
18
  value = current_emitter.context(*args, &block)
@@ -1,3 +1,3 @@
1
1
  module L2meter
2
- VERSION = "0.10.0".freeze
2
+ VERSION = "0.11.0".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.10.0
4
+ version: 0.11.0
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-04-07 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: