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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b34ca15c1ccd5e02e697e6cfbaab431b8a8e80482db7cd7ffd75c37e2c902c4
4
- data.tar.gz: 31bec113b6be9498b19f8e1842ee77316b333952988b930d1d74c3b8d11b2afc
3
+ metadata.gz: 221e5b91b1d4b4cf4f23b9b05d62f513260e099fe31f8442d990b8cb5d018c8d
4
+ data.tar.gz: 0f4b906fc126ab87c3505521de5c64c5cf37eaf0b310226059d913e4e8f10a84
5
5
  SHA512:
6
- metadata.gz: d23135c9d0c4740bf79ad76facfbf4d8649520c106c314ed8368263611999237c59a6a8eaeec934e044bebc6337fad742a2e6828873e9bcee63d962e3b4cd761
7
- data.tar.gz: f138359185e3ecec20f540ce8e3bcc80048bdfb82bb74532f46ccad87f660034260b9ab62887b231de198de609c5ab741ab59d2661583fc1db4f40ef3073d8b2
6
+ metadata.gz: 1c76a747bdf8434b11a28a1e30fbfd42dd19d918d6e3e79ccbb955dd9335879d269d7caecc21619acf266627105b73c659042f318c362662eb8bdbfda7291233
7
+ data.tar.gz: a21d127b08107f21bc999bfb7e4e38e1f639b2efe5ae0f9f15e8dae133e6e162e88f5f74de85cd2b3fb3f937799e45e126fb38745fa9c74c629dfa544e6a22db
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testa_logger (0.1.3)
4
+ testa_logger (0.1.5)
5
5
  activesupport
6
6
  awesome_print
7
7
  aws-sdk-s3
@@ -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: true)
256
+ arg.ai(limit: 1000, plain: false)
182
257
  end
183
258
  end.join("\n")
184
259
  end
@@ -1,3 +1,3 @@
1
1
  module TestaLogger
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testa_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - karlo.razumovic