logspot 0.6.1 → 0.6.2
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/Gemfile.lock +1 -1
- data/lib/logspot.rb +8 -4
- data/logspot.gemspec +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: 0373a708827acf8aee24e2bd09c43ebdb146aa0e
|
4
|
+
data.tar.gz: 5388889e9017ea2e3ced123835daddad20ba7ccb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd38e97b570b0b1feabf617806be2a47a1282882d2d4be53a02dbf0dccf0386ce6d4a728ee89b5764b98fb6c7f47301ab1d2fa8d2ec60ef4b88e5e3aaa2a863d
|
7
|
+
data.tar.gz: d14c08df7a755d438ca6c59a2d5e0f040b0161c0cb0997f9419fef2bf3665f0589d51e1b5211860a4a5b1fd8196645ed0ec01f8c5f25f8e136707641538a0800
|
data/Gemfile.lock
CHANGED
data/lib/logspot.rb
CHANGED
@@ -7,7 +7,7 @@ class LoGspot
|
|
7
7
|
wrapper = ->(output, data) {
|
8
8
|
base = tag_block ? tag_block.(Time.current, level) : tag_format % { time: Time.current.strftime(time_format), level: level }
|
9
9
|
if data[:space]
|
10
|
-
base = ' ' * base.length
|
10
|
+
base = ' ' * uncolorize_str(base).length
|
11
11
|
end
|
12
12
|
output.puts(message: "#{base}#{data[:message]}")
|
13
13
|
}
|
@@ -19,8 +19,8 @@ class LoGspot
|
|
19
19
|
def tagged(tag, &block)
|
20
20
|
wrap_output(block) do |output, data|
|
21
21
|
base = tag
|
22
|
-
if space =
|
23
|
-
base = ' ' * base.length
|
22
|
+
if space = data[:space]
|
23
|
+
base = ' ' * uncolorize_str(base).length
|
24
24
|
end
|
25
25
|
output.puts(data.merge(message: "#{base}#{data[:message]}", space: space))
|
26
26
|
end
|
@@ -32,7 +32,7 @@ class LoGspot
|
|
32
32
|
message = data[:message]
|
33
33
|
base = tag
|
34
34
|
if data[:space] || !first
|
35
|
-
base = ' ' * base.length
|
35
|
+
base = ' ' * uncolorize_str(base).length
|
36
36
|
end
|
37
37
|
if first
|
38
38
|
output.puts(data.merge(message: "#{base}#{message}", space: false))
|
@@ -116,4 +116,8 @@ class LoGspot
|
|
116
116
|
@output = previous_output
|
117
117
|
res
|
118
118
|
end
|
119
|
+
|
120
|
+
def uncolorize_str(str)
|
121
|
+
str.gsub(/\033\[[;0-9]+m/, '')
|
122
|
+
end
|
119
123
|
end
|
data/logspot.gemspec
CHANGED