extended_logger 0.5.2 → 0.5.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f455250170001f45e0124012bea062f08d8d072
|
4
|
+
data.tar.gz: 783a45d09ed579227e8b343e3cd3732fae593fab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5e3b1f15f2f8d7caa9416cc4c58e76296278daec801a54444203ac47b6685ec54961e7cfa1752f1b5fd6ee322d3a709701dfe892172ef41e5c64a4be8a1bc89
|
7
|
+
data.tar.gz: 3df9a339830cf81d580f610da7fa88053c7b30cb559d960759ed709b56c28d25e7abc3482d3bed3ddacf0794091a6a320501b6bb7c19e4e75093bdfa982d3411
|
@@ -96,6 +96,22 @@ class ExtendedLogger
|
|
96
96
|
new map
|
97
97
|
end
|
98
98
|
|
99
|
+
def self.resolve input
|
100
|
+
case input
|
101
|
+
when String then self.load input
|
102
|
+
when true then Default
|
103
|
+
else raise ArgumentError, "Cannot resolve color scheme for #{input.inspect}"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
AssignmentPattern = %r{\A
|
108
|
+
(?<label>[_A-Z]+)
|
109
|
+
=
|
110
|
+
(?<fg_code>[?[:xdigit:]])+
|
111
|
+
;
|
112
|
+
(?<bg_code>[?[:xdigit:]]+)\z
|
113
|
+
}nx
|
114
|
+
|
99
115
|
Colors = %i(
|
100
116
|
black
|
101
117
|
red
|
@@ -116,13 +132,14 @@ class ExtendedLogger
|
|
116
132
|
white
|
117
133
|
)
|
118
134
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
135
|
+
Default = self.build(
|
136
|
+
'DEBUG' => [:cyan, nil],
|
137
|
+
'INFO' => [nil, nil],
|
138
|
+
'WARN' => [:brown, nil],
|
139
|
+
'ERROR' => [:red, nil],
|
140
|
+
'FATAL' => [:white, :red],
|
141
|
+
'ANY' => [:white, :blue],
|
142
|
+
)
|
126
143
|
|
127
144
|
Null = self.new Hash.new
|
128
145
|
end
|
@@ -10,8 +10,8 @@ class ExtendedLogger
|
|
10
10
|
|
11
11
|
instance.always_interpolate = true if always_interpolate
|
12
12
|
|
13
|
-
if color_scheme
|
14
|
-
color_scheme = ColorScheme.
|
13
|
+
if color_scheme and io.tty?
|
14
|
+
color_scheme = ColorScheme.resolve color_scheme
|
15
15
|
instance.color_scheme = color_scheme
|
16
16
|
end
|
17
17
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extended_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Ladd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'An extended logger that provides a (mostly) substitutable alternative
|
14
14
|
to ruby''s built in +Logger+ class. A number of useful extensions are provided,
|