ruby_smart-simple_logger 1.5.1 → 1.5.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc624589a3aa7114bbec118563f3f802b046032abe1df2fbddf762971b99bf12
|
4
|
+
data.tar.gz: 94a9de8091320a9d5395878e1a22362e2ae15d0be0e497f2a6ff3d9f22eeddd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a80eff8cd646906a76abab041aa884fe769a4707e8b9ba7d819707664b71352108f1116eb5530711925bf6d1bc7eac104f5a2086bd050db41177e56d32f0874
|
7
|
+
data.tar.gz: 92c98897175040fc149e8825db0d1f941197b0aa301ea025731f38fb79a70ac09eff6833ebd622030167c2d530cf9db2dd7b5a9feaaf2ee5838561a9297ff991
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# RubySmart::SimpleLogger - CHANGELOG
|
2
2
|
|
3
|
+
## [1.5.3] - 2024-09-16
|
4
|
+
* **[fix]** scene `job`-, `sub_job`-methods not working with provided block
|
5
|
+
* **[fix]** scene `result`-methods not printing boolean results (also fixes exception for boolean/numeric results)
|
6
|
+
* **[fix]** fix color helper `_res_clr`-method to not raise for transforming to symbol
|
7
|
+
|
8
|
+
## [1.5.2] - 2024-09-12
|
9
|
+
* **[fix]** swap 'verbose' logging for `model` scene _(now uses FALSE by default)_
|
10
|
+
|
3
11
|
## [1.5.1] - 2024-09-12
|
4
12
|
* **[fix]** `RubySmart::SimpleLogger::KlassLogger` not forwarding kwargs
|
5
13
|
|
@@ -356,18 +356,24 @@ module RubySmart
|
|
356
356
|
# > :yellow
|
357
357
|
#
|
358
358
|
# _res_clr('not_really_a_color')
|
359
|
-
# > :
|
359
|
+
# > :green
|
360
360
|
#
|
361
|
-
# @param [Boolean, String, Integer, Symbol]
|
361
|
+
# @param [Boolean, String, Integer, Symbol] args
|
362
362
|
# @return [Symbol] color
|
363
|
-
def _res_clr(
|
364
|
-
case
|
365
|
-
when true, 1, '1'
|
363
|
+
def _res_clr(*args)
|
364
|
+
case (res = args.compact.first)
|
365
|
+
when true, 'true', 1, '1'
|
366
366
|
:green
|
367
|
-
when false, 0, '0'
|
367
|
+
when false, 'false', 0, '0', ''
|
368
368
|
:red
|
369
|
+
when '-', nil
|
370
|
+
:yellow
|
371
|
+
when String
|
372
|
+
:green
|
373
|
+
when Symbol
|
374
|
+
res
|
369
375
|
else
|
370
|
-
|
376
|
+
:grey
|
371
377
|
end
|
372
378
|
end
|
373
379
|
end
|
@@ -142,8 +142,7 @@ module RubySmart
|
|
142
142
|
# > -> Result
|
143
143
|
# >
|
144
144
|
base.scene :theme_result, { level: :debug, mask: { char: '-', length: 85, clr: :purple }, payload: [:mask, [:txt, '-> %{result}'], ''] } do |result, status = nil, **opts|
|
145
|
-
|
146
|
-
self.log nil, _scene_opts(:theme_result, result: result, clr: _res_clr(res_or_clr), **opts)
|
145
|
+
self.log nil, _scene_opts(:theme_result, result: result, clr: _res_clr(status, result), **opts)
|
147
146
|
end
|
148
147
|
|
149
148
|
# theme_line method
|
@@ -174,7 +173,7 @@ module RubySmart
|
|
174
173
|
# ________________________________________________________________ <- 64 chars
|
175
174
|
base.scene :job, { level: :debug, clr: :cyan, nl: false, length: 64, payload: [[:concat, ['- ', [:txt, '%{name}'], ' => ']]] } do |name, **opts, &block|
|
176
175
|
self.log nil, _scene_opts(:job, name: name, **opts)
|
177
|
-
self.result(*block.call) if
|
176
|
+
self.result(*block.call) if block
|
178
177
|
end
|
179
178
|
|
180
179
|
# sub_job method
|
@@ -186,7 +185,7 @@ module RubySmart
|
|
186
185
|
# ______________________________________________________________ <- 62 chars
|
187
186
|
base.scene :sub_job, { level: :debug, clr: :cyan, nl: false, length: 62, payload: [[:concat, [' * ', [:txt, '%{name}'], ' => ']]] } do |name, **opts, &block|
|
188
187
|
self.log nil, _scene_opts(:sub_job, name: name, **opts)
|
189
|
-
self.result(*block.call) if
|
188
|
+
self.result(*block.call) if block
|
190
189
|
end
|
191
190
|
|
192
191
|
# result method
|
@@ -195,8 +194,7 @@ module RubySmart
|
|
195
194
|
#
|
196
195
|
# > Result
|
197
196
|
base.scene :result, { level: :debug, payload: [[:txt, '%{result}']] } do |result, status = nil, **opts|
|
198
|
-
|
199
|
-
self.log nil, _scene_opts(:result, result: result, clr: _res_clr(res_or_clr), **opts)
|
197
|
+
self.log nil, _scene_opts(:result, result: result.to_s, clr: _res_clr(status, result), **opts)
|
200
198
|
end
|
201
199
|
|
202
200
|
# job_result method
|
@@ -257,12 +255,13 @@ module RubySmart
|
|
257
255
|
#
|
258
256
|
# > .FFF...??...F....F...F..???....F...??
|
259
257
|
base.scene :spec, { level: :debug, nl: false, payload: [[:txt, '%{result}']] } do |status, **opts|
|
260
|
-
result =
|
258
|
+
result = case status
|
259
|
+
when true
|
261
260
|
'.'
|
262
|
-
|
261
|
+
when false
|
263
262
|
'F'
|
264
263
|
else
|
265
|
-
status = :yellow
|
264
|
+
status = nil # IMPORTANT: reset to nil will enforce a 'yellow' color
|
266
265
|
'?'
|
267
266
|
end
|
268
267
|
self.log nil, _scene_opts(:spec, result: result, clr: _res_clr(status), **opts)
|
@@ -338,7 +337,7 @@ module RubySmart
|
|
338
337
|
result_str ||= ''
|
339
338
|
|
340
339
|
# send END name with result & possible time as +data+ - the full log line is created through the +_pcd+ method.
|
341
|
-
self.log("#{name} #{result_str}#{(timer_key ? "(#{self.timer(:clear, timer_key, humanized: true)})" : '')}", _scene_opts(:processed, **opts, pcd: :end
|
340
|
+
self.log("#{name} #{result_str}#{(timer_key ? "(#{self.timer(:clear, timer_key, humanized: true)})" : '')}", _scene_opts(:processed, **opts, pcd: :end))
|
342
341
|
|
343
342
|
# reduce level
|
344
343
|
processed_lvl(:down)
|
@@ -361,7 +360,7 @@ module RubySmart
|
|
361
360
|
case status
|
362
361
|
when :success
|
363
362
|
# show verbose logging for updated records
|
364
|
-
if opts[:verbose]
|
363
|
+
if opts[:verbose] && !model.previously_new_record?
|
365
364
|
self.success("#{mdl_string} (#{model.previous_changes.inspect})", tag: "#{model.class.name.upcase}|UPDATED", **opts)
|
366
365
|
else
|
367
366
|
self.success(mdl_string, tag: "#{model.class.name.upcase}|#{(model.previously_new_record? ? 'CREATED' : 'UPDATED')}", **opts)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_smart-simple_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Gonsior
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_smart-support
|