xyeger 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/xyeger/formatters/base.rb +8 -0
- data/lib/xyeger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3150af17290987d039118dc67a90951341f23e87
|
4
|
+
data.tar.gz: 34c6b9e38a4ba8a7e5f7ab97d50c2d3e5344bb8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2c727284665e027396d4af769be42a81787fc4886ca58149a2f3c92c8cb99afe5b8e57cf78538f4f02a57c72812dc4694eda55de4e63a433cd0b60acd93be4f
|
7
|
+
data.tar.gz: 71f2404cd76e694abea476ff7967038c1618f98ba56d0c1ea8d5d1ed6cf270ac41cd1a53134d101f5744f89ca5c985a37830d0065b0052a3c4cb43efeff29fdc
|
data/README.md
CHANGED
@@ -170,6 +170,13 @@ Sidekiq::Logging.logger = Xyeger::Logger.new(STDOUT)
|
|
170
170
|
Sidekiq::Logging.logger.formatter = Xyeger::Formatters::SidekiqJson.new
|
171
171
|
```
|
172
172
|
|
173
|
+
## ActiveRecord usage
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
# config/initializers/xyeger.rb
|
177
|
+
ActiveRecord::Base.logger = Rails.logger
|
178
|
+
```
|
179
|
+
|
173
180
|
|
174
181
|
## License
|
175
182
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Xyeger
|
2
2
|
module Formatters
|
3
3
|
class Base
|
4
|
+
UNCOLORIZE_REGEXP = /\e\[([;\d]+)?m/
|
5
|
+
|
4
6
|
attr_reader :attributes, :colors
|
5
7
|
|
6
8
|
def initialize(attributes = {})
|
@@ -37,6 +39,8 @@ module Xyeger
|
|
37
39
|
end
|
38
40
|
|
39
41
|
private def prepare(message, context)
|
42
|
+
message = uncolorize(message) unless attributes[:colored]
|
43
|
+
|
40
44
|
new_message = attributes[:message].call(message, context) if attributes[:message]
|
41
45
|
new_context = attributes[:context].call(message, context) if attributes[:context]
|
42
46
|
|
@@ -63,6 +67,10 @@ module Xyeger
|
|
63
67
|
|
64
68
|
Xyeger.config.filter.filter(context)
|
65
69
|
end
|
70
|
+
|
71
|
+
def uncolorize(message)
|
72
|
+
message.gsub(UNCOLORIZE_REGEXP, '')
|
73
|
+
end
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
data/lib/xyeger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xyeger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avramov Vsevolod
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lograge
|