xyeger 0.3.1 → 0.3.3
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.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/xyeger.rb +1 -0
- data/lib/xyeger/formatters/base.rb +4 -0
- data/lib/xyeger/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb1d2c932348f4c0d7e3b2fe8199fd8cdfd71ecd
|
4
|
+
data.tar.gz: 5f496b76ee4a6e8aeddeade083839981d9dc998b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2e702a220fc14d6ae52718a0ed70ec13c7dff04c77ee1186dada6e323a100b4f9da902bc3663e9e91e77402080ee44fc05aa304d370c7bbc5047eb6c02e2635
|
7
|
+
data.tar.gz: a998c275f6068c22c0e947925d6876efafdea0853cc6e1d1e2a5609c7229ea56f9861a3945340619aa30fdf88e1f8c20856f9e9eaa0fbaa38fa1b7d8d05f6fe9
|
data/README.md
CHANGED
@@ -169,6 +169,30 @@ end
|
|
169
169
|
Sidekiq::Logging.logger.formatter = Xyeger::Formatters::SidekiqJson.new
|
170
170
|
```
|
171
171
|
|
172
|
+
## TaggedLogging example
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
Rails.logger.tagged('main', 'object_id') { Rails.logger.info('Message text', { id: 33 }) }
|
176
|
+
```
|
177
|
+
```json
|
178
|
+
{
|
179
|
+
"pid" : 9210,
|
180
|
+
"app" : "Cryptopay",
|
181
|
+
"env" : "development",
|
182
|
+
"level" : "INFO",
|
183
|
+
"time" : "2017-07-18T19:42:53.373+03:00",
|
184
|
+
"message" : "Message text",
|
185
|
+
"context" : {
|
186
|
+
"id" : 33
|
187
|
+
},
|
188
|
+
"tags" : [
|
189
|
+
"main",
|
190
|
+
"object_id"
|
191
|
+
]
|
192
|
+
}
|
193
|
+
```
|
194
|
+
|
195
|
+
|
172
196
|
## License
|
173
197
|
|
174
198
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/xyeger.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
module Xyeger
|
2
2
|
module Formatters
|
3
3
|
class Base
|
4
|
+
include ActiveSupport::TaggedLogging::Formatter
|
5
|
+
|
4
6
|
UNCOLORIZE_REGEXP = /\e\[([;\d]+)?m/
|
5
7
|
|
6
8
|
attr_reader :attributes, :colors
|
7
9
|
|
8
10
|
def initialize(attributes = {})
|
9
11
|
@attributes = attributes
|
12
|
+
@tags = []
|
10
13
|
@colors = Array.new(9) { Paint.random } if attributes[:colored]
|
11
14
|
end
|
12
15
|
|
@@ -26,6 +29,7 @@ module Xyeger
|
|
26
29
|
context: context
|
27
30
|
}
|
28
31
|
|
32
|
+
result[:tags] = current_tags if current_tags.any?
|
29
33
|
colored(result) if attributes[:colored]
|
30
34
|
|
31
35
|
result
|
data/lib/xyeger/version.rb
CHANGED