testa_logger 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/testa_logger/logger.rb +76 -1
- data/lib/testa_logger/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 221e5b91b1d4b4cf4f23b9b05d62f513260e099fe31f8442d990b8cb5d018c8d
|
4
|
+
data.tar.gz: 0f4b906fc126ab87c3505521de5c64c5cf37eaf0b310226059d913e4e8f10a84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c76a747bdf8434b11a28a1e30fbfd42dd19d918d6e3e79ccbb955dd9335879d269d7caecc21619acf266627105b73c659042f318c362662eb8bdbfda7291233
|
7
|
+
data.tar.gz: a21d127b08107f21bc999bfb7e4e38e1f639b2efe5ae0f9f15e8dae133e6e162e88f5f74de85cd2b3fb3f937799e45e126fb38745fa9c74c629dfa544e6a22db
|
data/Gemfile.lock
CHANGED
data/lib/testa_logger/logger.rb
CHANGED
@@ -114,6 +114,81 @@ module TestaLogger
|
|
114
114
|
add_log_to_queue(UNKNOWN, tag, args, &block)
|
115
115
|
end
|
116
116
|
|
117
|
+
def level=(severity)
|
118
|
+
if severity.is_a?(Integer)
|
119
|
+
@level = severity
|
120
|
+
else
|
121
|
+
SEV_LABEL.index(severity.to_s.downcase.upcase).to_i
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Returns +true+ iff the current severity level allows for the printing of
|
126
|
+
# +DEBUG+ messages.
|
127
|
+
def debug?
|
128
|
+
options.level <= DEBUG
|
129
|
+
end
|
130
|
+
|
131
|
+
# Sets the severity to DEBUG.
|
132
|
+
def debug!
|
133
|
+
options.level = DEBUG
|
134
|
+
end
|
135
|
+
|
136
|
+
# Returns +true+ iff the current severity level allows for the printing of
|
137
|
+
# +INFO+ messages.
|
138
|
+
def info?
|
139
|
+
options.level <= INFO
|
140
|
+
end
|
141
|
+
|
142
|
+
# Sets the severity to INFO.
|
143
|
+
def info!
|
144
|
+
options.level = INFO
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns +true+ iff the current severity level allows for the printing of
|
148
|
+
# +WARN+ messages.
|
149
|
+
def warn?
|
150
|
+
options.level <= WARN
|
151
|
+
end
|
152
|
+
|
153
|
+
# Sets the severity to WARN.
|
154
|
+
def warn!
|
155
|
+
options.level = WARN
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns +true+ iff the current severity level allows for the printing of
|
159
|
+
# +ERROR+ messages.
|
160
|
+
def error?
|
161
|
+
options.level <= ERROR
|
162
|
+
end
|
163
|
+
|
164
|
+
# Sets the severity to ERROR.
|
165
|
+
def error!
|
166
|
+
options.level = ERROR
|
167
|
+
end
|
168
|
+
|
169
|
+
# Returns +true+ iff the current severity level allows for the printing of
|
170
|
+
# +FATAL+ messages.
|
171
|
+
def fatal?
|
172
|
+
options.level <= FATAL
|
173
|
+
end
|
174
|
+
|
175
|
+
# Sets the severity to FATAL.
|
176
|
+
def fatal!
|
177
|
+
options.level = FATAL
|
178
|
+
end
|
179
|
+
|
180
|
+
def level
|
181
|
+
options.level
|
182
|
+
end
|
183
|
+
|
184
|
+
def silence(severity = ERROR, &block)
|
185
|
+
old_level = options.level
|
186
|
+
options.level = severity
|
187
|
+
result = block&.call
|
188
|
+
options.level = old_level
|
189
|
+
result
|
190
|
+
end
|
191
|
+
|
117
192
|
class << self
|
118
193
|
def default_options
|
119
194
|
OpenStruct.new(
|
@@ -178,7 +253,7 @@ module TestaLogger
|
|
178
253
|
if arg.instance_of?(String)
|
179
254
|
arg
|
180
255
|
else
|
181
|
-
arg.ai(limit: 1000, plain:
|
256
|
+
arg.ai(limit: 1000, plain: false)
|
182
257
|
end
|
183
258
|
end.join("\n")
|
184
259
|
end
|
data/lib/testa_logger/version.rb
CHANGED