k_log 0.0.32 → 0.0.33
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/lib/k_log/log_structure.rb +4 -5
- data/lib/k_log/log_util.rb +3 -2
- data/lib/k_log/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3da75f77f8bb9b46e9d0559c34b854370fc27d8ec7f6875c2347175b653a55e2
|
|
4
|
+
data.tar.gz: e33dc1ff91012483851f090610185f58f56efd593ab32210b1036c67405793f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b65b497177e307477305f749f866437e11722ca71078e08b71d97dc687e3ac928af10f3c1152851b0507b8da18ccaf1bf6781ed1338b24573e5b1eb6e0da2b1
|
|
7
|
+
data.tar.gz: c81b2a859e0ce0cf7eb6bc5353bfad1beedd530d64545b91dd03a2b2b3a03da4488fcfd2cda3a2791d6793aefd58306262a7d1bdcc09cb7ca4dc1f9294a4a8f3
|
data/lib/k_log/log_structure.rb
CHANGED
|
@@ -37,7 +37,7 @@ module KLog
|
|
|
37
37
|
# @option opts [String] :key_width key width defaults to 30, but can be overridden here
|
|
38
38
|
# @option opts [String] :formatter is a complex configuration for formatting different data within the structure
|
|
39
39
|
# @option opts [Symbol] :convert_data_to (:raw, open_struct)
|
|
40
|
-
def initialize(opts)
|
|
40
|
+
def initialize(**opts)
|
|
41
41
|
@indent = opts[:indent] || ' '
|
|
42
42
|
@title = opts[:title]
|
|
43
43
|
@title_type = opts[:title_type] || :heading
|
|
@@ -71,6 +71,7 @@ module KLog
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def log(data)
|
|
74
|
+
return puts 'log.structure(data) is nil' if data.nil?
|
|
74
75
|
log_heading(title, title_type) if title
|
|
75
76
|
|
|
76
77
|
data = convert_data(data)
|
|
@@ -337,16 +338,14 @@ module KLog
|
|
|
337
338
|
end
|
|
338
339
|
|
|
339
340
|
def for(log_structure, graph, graph_path)
|
|
340
|
-
# node_config = graph_path.inject(graph, :send) # (uses deep nesting, but fails when nil is returned) https://stackoverflow.com/questions/15862455/ruby-nested-send
|
|
341
|
-
# node.nil? ? null : node.send(name) || null
|
|
342
341
|
node_config = graph_path.reduce(graph) do |node, name|
|
|
343
|
-
|
|
342
|
+
# handling the issue where name was :sleep
|
|
343
|
+
result = node.respond_to?(name) ? node.send(name) : nil
|
|
344
344
|
|
|
345
345
|
break null if result.nil?
|
|
346
346
|
|
|
347
347
|
result
|
|
348
348
|
end
|
|
349
|
-
# puts node_config
|
|
350
349
|
|
|
351
350
|
new(log_structure, node_config)
|
|
352
351
|
end
|
data/lib/k_log/log_util.rb
CHANGED
|
@@ -148,7 +148,7 @@ module KLog
|
|
|
148
148
|
# @option opts [String] :heading_type :heading, :subheading, :section_heading
|
|
149
149
|
# @option opts [Boolean] :skip_array Arrays items can be skipped
|
|
150
150
|
def structure(data, **opts)
|
|
151
|
-
structure = LogStructure.new(opts)
|
|
151
|
+
structure = LogStructure.new(**opts)
|
|
152
152
|
structure.log(data)
|
|
153
153
|
end
|
|
154
154
|
|
|
@@ -196,9 +196,10 @@ module KLog
|
|
|
196
196
|
alias o open_struct
|
|
197
197
|
|
|
198
198
|
# Examples
|
|
199
|
-
# log.exception(e)
|
|
199
|
+
# log.exception(e) # <- :long
|
|
200
200
|
# log.exception(e, style: :message)
|
|
201
201
|
# log.exception(e, style: :short)
|
|
202
|
+
# log.exception(e, style: :long)
|
|
202
203
|
def exception(exception, style: :long, method_info: nil)
|
|
203
204
|
line unless style == :message
|
|
204
205
|
|
data/lib/k_log/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: k_log
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.33
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cruwys
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-04-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: k_util
|
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
98
|
version: '0'
|
|
99
99
|
requirements: []
|
|
100
|
-
rubygems_version: 3.2.
|
|
100
|
+
rubygems_version: 3.2.33
|
|
101
101
|
signing_key:
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: KLog provides console logging helpers and formatters
|