README.md in l2meter-0.2.4 vs README.md in l2meter-0.3.0
- old
+ new
@@ -38,11 +38,11 @@
In case the exception is raised inside the block, l2meter will report is like
so:
```ruby
-Metrics.log :doing_work do # => doing-work
+Metrics.log :doing_work do # => doing-work at=start
raise ArgumentError, \ #
"something is wrong" #
end # => doing-work at=exception exception=ArgumentError message="something is wrong" elapsed=1.2345s
```
@@ -105,16 +105,27 @@
L2meter also allows to append elapsed time to your log messages automatically.
```ruby
Metrics.with_elapsed do
do_work_step_1
- log :step_1_done # => step-1-done elapsed=1.2345s
+ Metrics.log :step_1_done # => step-1-done elapsed=1.2345s
do_work_step_2
- log :step_2_done # => step-2-done elapsed=2.3456s
+ Metrics.log :step_2_done # => step-2-done elapsed=2.3456s
end
```
+There's also a way to batch several calls into a single log line:
+
+```ruby
+Metrics.batch do
+ Metrics.log foo: :bar
+ Metrics.unique :registeration, "user@example.com"
+ Metrics.count :thing, 10
+ Metrics.sample :other_thing, 20
+end # => foo=bar unique#registration=user@example.com count#thing=10 sample#other-thing=20
+```
+
### Configuration
L2meter supports configuration. Here's how you can configure things:
```ruby
@@ -138,10 +149,10 @@
```
Dynamic context is also supported:
```ruby
-context.context do
+config.context do
{ request_id: CurrentContext.request_id }
end
```
#### Sorting