debug_logging 4.0.5 → 4.1.0

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: c07adf4ce090f66cddfa9c79c7e365910e512a1594ce42b01dc9b08937cba496
4
- data.tar.gz: 25872a14875d155d6d0e5ada1e798a5e0dc4e6fd54663225243db2d6c2a34f8c
3
+ metadata.gz: 07a1d4c942b3a784a80ee0b72882b3c3c1d098a16e1e789963051e92c9ad4ae0
4
+ data.tar.gz: 9cd8ebc10d446eb9bb25088180a3f078dea600248a2a4144c7d1f4c6a719f32d
5
5
  SHA512:
6
- metadata.gz: 11afaaea977ac656bfffc1f94f1e93cc28853b2d183a29d8f26ad1d3d143a7be64fdeb3ea719f9d14a24f9ca9616570de3e60fa6e60006f9243abab8b25cc876
7
- data.tar.gz: 2a82a36a4da174576ca77e2353dad2bb1dd705cfb15acf485582ca223edbd72c2b6164b853abbd09e33983f69703054205db9ddd937eb1cda6d39bc661cd01bf
6
+ metadata.gz: 4534e3a8bba1767e856e3ac60f855d8ab4100cfa2d1fc23102ee657592ada1473ceac57826fd730e5e9c9b0072f35a869134e5755db7fecde6b1a7e922505ffe
7
+ data.tar.gz: b651325b49c4cfbcf475b100a64f9858eed735a0c9087d24b1bbdcff999e4b2ce20dd8c571e6a454ba5b95231e33c7c98cd8c5f73c50c66926ff9f9fc537a1ff
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,19 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [4.1.0] - 2026-07-02
34
+
35
+ - TAG: [v4.1.0][4.1.0t]
36
+ - COVERAGE: 97.46% -- 730/749 lines in 28 files
37
+ - BRANCH COVERAGE: 86.34% -- 177/205 branches in 28 files
38
+ - 20.94% documented
39
+
40
+ ### Added
41
+
42
+ - Ruby keyword option support for `logged`, `notified`, `i_logged`, and
43
+ `i_notified`, while preserving legacy last-hash configuration and payload
44
+ handling.
45
+
33
46
  ## [4.0.5] - 2026-07-02
34
47
 
35
48
  - TAG: [v4.0.5][4.0.5t]
@@ -312,7 +325,9 @@ Please file a bug if you notice a violation of semantic versioning.
312
325
 
313
326
  - Initial release
314
327
 
315
- [Unreleased]: https://github.com/galtzo-floss/debug_logging/compare/v4.0.5...HEAD
328
+ [Unreleased]: https://github.com/galtzo-floss/debug_logging/compare/v4.1.0...HEAD
329
+ [4.1.0]: https://github.com/galtzo-floss/debug_logging/compare/v4.0.5...v4.1.0
330
+ [4.1.0t]: https://github.com/galtzo-floss/debug_logging/releases/tag/v4.1.0
316
331
  [4.0.5]: https://github.com/galtzo-floss/debug_logging/compare/v4.0.4...v4.0.5
317
332
  [4.0.5t]: https://github.com/galtzo-floss/debug_logging/releases/tag/v4.0.5
318
333
  [4.0.4]: https://github.com/galtzo-floss/debug_logging/compare/v4.0.3...v4.0.4
data/README.md CHANGED
@@ -797,7 +797,7 @@ Thanks for RTFM. ☺️
797
797
  [📌gitmoji]: https://gitmoji.dev
798
798
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
799
799
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
800
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.745-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
800
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.749-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
801
801
  [🔐security]: https://github.com/galtzo-floss/debug_logging/blob/main/SECURITY.md
802
802
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
803
803
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -6,11 +6,12 @@ module DebugLogging
6
6
  end
7
7
  end
8
8
 
9
- def logged(*methods_to_log)
9
+ def logged(*methods_to_log, **options)
10
10
  methods_to_log, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
11
11
  method_names: methods_to_log,
12
12
  payload: nil,
13
- config: nil
13
+ config: nil,
14
+ options:
14
15
  )
15
16
  Array(methods_to_log).each do |decorated_method|
16
17
  decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
@@ -6,11 +6,12 @@ module DebugLogging
6
6
  end
7
7
  end
8
8
 
9
- def notified(*methods_to_notify)
9
+ def notified(*methods_to_notify, **options)
10
10
  methods_to_notify, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
11
11
  method_names: methods_to_notify,
12
12
  payload: nil,
13
- config: nil
13
+ config: nil,
14
+ options:
14
15
  )
15
16
  Array(methods_to_notify).each do |decorated_method|
16
17
  decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
@@ -6,33 +6,33 @@ module DebugLogging
6
6
  end
7
7
  end
8
8
 
9
- # NOTE: These params can be passed in / hidden in a last hash of *args
9
+ # NOTE: These options can also be passed in / hidden in a last hash of *args
10
10
  # NOTE: They can also be passed in discretely for each method, by passing *args as an array of arrays
11
- # TODO: Refactor to use modern Ruby 3 *args, **kwargs instead
12
- # @param logger [Logger] Logger.new($stdout), # probably want to override to be the Rails.logger
13
- # @param log_level [Symbol] default: :debug, at what level do the messages created by this gem sent at?
14
- # @param multiple_last_hashes [true, false] default: false,
15
- # @param last_hash_to_s_proc [nil, Proc] default: nil, e.g. ->(hash) { "keys: #{hash.keys}" }
16
- # @param last_hash_max_length [Integer] default: 1_000,
17
- # @param args_to_s_proc [nil, Proc] default: nil, e.g. ->(*record) { "record id: #{record.first.id}" }
18
- # @param args_max_length [Integer] default: 1_000,
19
- # @param colorized_chain_for_method [false, Proc] default: false, e.g. ->(colorized_string) { colorized_string.red.on_blue.underline }
20
- # @param colorized_chain_for_class [false, Proc] default: false, e.g. ->(colorized_string) { colorized_string.colorize(:light_blue ).colorize( :background => :red) }
21
- # @param add_invocation_id [true, false] default: true, allows unique identification of method call; association of entry and exit log lines
22
- # @param ellipsis [String] default: " ✂️ …".freeze,
23
- # @param mark_scope_exit [true, false] default: false,
24
- # @param add_payload [true, false, Proc] default: true, # Can also be a proc returning a string, which will be called when printing the payload
25
- # @param payload_max_length [Integer] default: 1_000,
26
- # @param error_handler_proc [nil, Proc] default: nil,
27
- # @param time_formatter_proc [nil, Proc] default: DebugLogging::Constants::DEFAULT_TIME_FORMATTER,
28
- # @param add_timestamp [true, false] default: false,
29
- # @param instance_benchmarks [true, false] default: false,
30
- # @param class_benchmarks [true, false] default: false,
31
- def i_logged(*methods_to_log)
11
+ # @option options [Logger] :logger Logger.new($stdout), # probably want to override to be the Rails.logger
12
+ # @option options [Symbol] :log_level default: :debug, at what level do the messages created by this gem sent at?
13
+ # @option options [true, false] :multiple_last_hashes default: false,
14
+ # @option options [nil, Proc] :last_hash_to_s_proc default: nil, e.g. ->(hash) { "keys: #{hash.keys}" }
15
+ # @option options [Integer] :last_hash_max_length default: 1_000,
16
+ # @option options [nil, Proc] :args_to_s_proc default: nil, e.g. ->(*record) { "record id: #{record.first.id}" }
17
+ # @option options [Integer] :args_max_length default: 1_000,
18
+ # @option options [false, Proc] :colorized_chain_for_method default: false, e.g. ->(colorized_string) { colorized_string.red.on_blue.underline }
19
+ # @option options [false, Proc] :colorized_chain_for_class default: false, e.g. ->(colorized_string) { colorized_string.colorize(:light_blue ).colorize( :background => :red) }
20
+ # @option options [true, false] :add_invocation_id default: true, allows unique identification of method call; association of entry and exit log lines
21
+ # @option options [String] :ellipsis default: " ✂️ …".freeze,
22
+ # @option options [true, false] :mark_scope_exit default: false,
23
+ # @option options [true, false, Proc] :add_payload default: true, # Can also be a proc returning a string, which will be called when printing the payload
24
+ # @option options [Integer] :payload_max_length default: 1_000,
25
+ # @option options [nil, Proc] :error_handler_proc default: nil,
26
+ # @option options [nil, Proc] :time_formatter_proc default: DebugLogging::Constants::DEFAULT_TIME_FORMATTER,
27
+ # @option options [true, false] :add_timestamp default: false,
28
+ # @option options [true, false] :instance_benchmarks default: false,
29
+ # @option options [true, false] :class_benchmarks default: false,
30
+ def i_logged(*methods_to_log, **options)
32
31
  methods_to_log, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
33
32
  method_names: methods_to_log,
34
33
  payload: nil,
35
- config: nil
34
+ config: nil,
35
+ options:
36
36
  )
37
37
  instance_method_modules =
38
38
  Array(methods_to_log).map do |decorated_method|
@@ -6,11 +6,12 @@ module DebugLogging
6
6
  end
7
7
  end
8
8
 
9
- def i_notified(*methods_to_log)
9
+ def i_notified(*methods_to_log, **options)
10
10
  method_names, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
11
11
  method_names: methods_to_log,
12
12
  payload: nil,
13
- config: nil
13
+ config: nil,
14
+ options:
14
15
  )
15
16
  instance_method_notifier = DebugLogging::InstanceNotifierModulizer.to_mod(
16
17
  methods_to_notify: Array(method_names),
@@ -18,7 +18,7 @@ module DebugLogging
18
18
 
19
19
  # methods_to_log may be an array of a single method name, followed by config options and payload,
20
20
  # or it could be an array of method names followed by config options and payload to be shared by the whole set.
21
- def extract_payload_and_config(method_names:, payload: nil, config: nil)
21
+ def extract_payload_and_config(method_names:, payload: nil, config: nil, options: nil)
22
22
  # When scoped config is present it will always be a new configuration instance per method
23
23
  # When scoped config is not present it will reuse the class' configuration object
24
24
  scoped_payload = (method_names.is_a?(Array) && method_names.last.is_a?(Hash) && method_names.pop.clone(freeze: false)) || {}
@@ -32,6 +32,11 @@ module DebugLogging
32
32
  unless payload.empty?
33
33
  DebugLogging::Configuration::CONFIG_KEYS.each { |k| config_opts[k] = payload.delete(k) if payload.key?(k) }
34
34
  end
35
+ if options && !options.empty?
36
+ scoped_options = options.clone(freeze: false)
37
+ DebugLogging::Configuration::CONFIG_KEYS.each { |k| config_opts[k] = scoped_options.delete(k) if scoped_options.key?(k) }
38
+ payload.merge!(scoped_options)
39
+ end
35
40
  method_names =
36
41
  case method_names
37
42
  when Symbol
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DebugLogging
4
4
  module Version
5
- VERSION = "4.0.5"
5
+ VERSION = "4.1.0"
6
6
  end
7
7
  VERSION = Version::VERSION # Traditional Constant Location
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debug_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.5
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -318,10 +318,10 @@ licenses:
318
318
  - MIT
319
319
  metadata:
320
320
  homepage_uri: https://debug-logging.galtzo.com/
321
- source_code_uri: https://github.com/galtzo-floss/debug_logging/tree/v4.0.5
322
- changelog_uri: https://github.com/galtzo-floss/debug_logging/blob/v4.0.5/CHANGELOG.md
321
+ source_code_uri: https://github.com/galtzo-floss/debug_logging/tree/v4.1.0
322
+ changelog_uri: https://github.com/galtzo-floss/debug_logging/blob/v4.1.0/CHANGELOG.md
323
323
  bug_tracker_uri: https://github.com/galtzo-floss/debug_logging/issues
324
- documentation_uri: https://www.rubydoc.info/gems/debug_logging/4.0.5
324
+ documentation_uri: https://www.rubydoc.info/gems/debug_logging/4.1.0
325
325
  funding_uri: https://github.com/sponsors/pboling
326
326
  wiki_uri: https://github.com/galtzo-floss/debug_logging/wiki
327
327
  news_uri: https://www.railsbling.com/tags/debug_logging
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- 3p�d?^/U�U1<1J�S�D�~�ߓ�4�4oۼ���Cm��qk��pP[<8N7y�Dt_�GŬ�QG��_� |cN��EVr��n+�u=�j�!g-�uE�<� ����i��/�����.���S�W��֖�a߻xx��sR�:��*�/�k���WNM%0�\�ϥtl\�x{rkJ���
2
- s�����%�?����ջ�7�*�gG�ђ$�b�}hw]� ���_uodŒ�uT�&$^K��
3
- (���6v��};~�R �7����h�T��Ӵ�*��F��\$H����'\���bmTR€Q/�5��8��殎'LB��{�����"�_��o58O�[E�R?W���5�^�<�s�U����u�w靅�A�1����
1
+ �����d&M4�&Er�˗y��9�"Ƚ77a�?��Xot��^��`��;~>d9| ���_=�S%� G�Ǵ �����IE?��Y"}!0�|��W��8go�½͘�i��Vn��ȽDH���gR�
2
+ 9{L�}U OT)fm��bxl�EUAH{�>�B� �Ml�^�yE�[c�aVR�~/� �f��r�}�XL��=�jS�;I���iE�%Va�KŒMpG�F@���F���J���� ��PԄ�;$��w�����$#���?�l�"�k�$���i��1�����#�dFsͻZ>���c�t�M��l�kt�V�&U!