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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fa223a72a5c70dcb1c311f1da3c1e5f370c64847942a2e4e8dccf3abff05fd1
4
- data.tar.gz: ab980569c01e1c99a99c157623f92a75d08a6af82163d929130f8bc1080658b2
3
+ metadata.gz: 3da75f77f8bb9b46e9d0559c34b854370fc27d8ec7f6875c2347175b653a55e2
4
+ data.tar.gz: e33dc1ff91012483851f090610185f58f56efd593ab32210b1036c67405793f8
5
5
  SHA512:
6
- metadata.gz: f1fe198aee1f8dab3e7fad5676eb209abb8e034162b26a52edc36c107dfc7606f1db5f18bbbafa8eaf120499ebc18cea302eac8aa6acadd3f2debf01dc23c1fd
7
- data.tar.gz: 62f28c9a49847aaec1896759ff3ab0d9c367e84ff67c4ef80baa018d32bd25ac0cc9e4c30704d3aba9a660b38443ced2e4f6ba4418e065e6adc8d68853a3c177
6
+ metadata.gz: 9b65b497177e307477305f749f866437e11722ca71078e08b71d97dc687e3ac928af10f3c1152851b0507b8da18ccaf1bf6781ed1338b24573e5b1eb6e0da2b1
7
+ data.tar.gz: c81b2a859e0ce0cf7eb6bc5353bfad1beedd530d64545b91dd03a2b2b3a03da4488fcfd2cda3a2791d6793aefd58306262a7d1bdcc09cb7ca4dc1f9294a4a8f3
@@ -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
- result = node.send(name)
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KLog
4
- VERSION = '0.0.32'
4
+ VERSION = '0.0.33'
5
5
  end
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.32
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: 2021-11-24 00:00:00.000000000 Z
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.7
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