debug_logging 4.0.1 → 4.0.2
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +16 -1
- data/CONTRIBUTING.md +1 -1
- data/README.md +12 -8
- data/lib/debug_logging/argument_printer.rb +6 -6
- data/lib/debug_logging/class_logger.rb +26 -56
- data/lib/debug_logging/class_notifier.rb +22 -38
- data/lib/debug_logging/configuration.rb +2 -2
- data/lib/debug_logging/hooks.rb +7 -5
- data/lib/debug_logging/instance_logger.rb +8 -2
- data/lib/debug_logging/instance_logger_modulizer.rb +19 -49
- data/lib/debug_logging/instance_notifier.rb +6 -0
- data/lib/debug_logging/instance_notifier_modulizer.rb +15 -31
- data/lib/debug_logging/lamb_dart/base.rb +46 -0
- data/lib/debug_logging/lamb_dart/log.rb +47 -0
- data/lib/debug_logging/lamb_dart/note.rb +30 -0
- data/lib/debug_logging/lamb_dart.rb +9 -0
- data/lib/debug_logging/lamb_dartable.rb +41 -0
- data/lib/debug_logging/lamb_darts/benchmarked.rb +19 -0
- data/lib/debug_logging/lamb_darts/enter_log.rb +16 -0
- data/lib/debug_logging/lamb_darts/error_handle.rb +28 -0
- data/lib/debug_logging/lamb_darts/exit_log.rb +15 -0
- data/lib/debug_logging/lamb_darts/notify.rb +17 -0
- data/lib/debug_logging/util.rb +23 -19
- data/lib/debug_logging/version.rb +1 -1
- data/lib/debug_logging.rb +2 -7
- data/lib/simple_debug_logging.rb +18 -16
- data.tar.gz.sig +0 -0
- metadata +62 -12
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5059baba71c02b6f460a6cc3badf9871441b16e926afe59636ad7ef2f8b907c
|
4
|
+
data.tar.gz: 9ac589b2e46cd7f439f45751c50404e09bf07f0cc2b5e9713b93d83338e2f5e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed2fdd91670149c07f1ef0c118fda035b858b63cbe87d7d09000c18ab14f4133bf37a340ad11ec0c851be4bd2f1e2b807444a21b3bb002cdbaa6f8b9ddb6b17e
|
7
|
+
data.tar.gz: 41bedf5260a5e667d0dc6570987f26c05a66651638623e2cfddbaf132782e50067693d1f1bc9660808146456a06ab5e4c8f497de5555783e6aa073c5cabb811e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
11
11
|
### Fixed
|
12
12
|
### Removed
|
13
13
|
|
14
|
+
## [4.0.2] ([tag][4.0.2t]) - 2024-05-12
|
15
|
+
### Added
|
16
|
+
- More documentation
|
17
|
+
### Changed
|
18
|
+
- DRY logic for `DebugLogging::ClassLogger` & `DebugLogging::InstanceLogger` via `LambDart`
|
19
|
+
- Refactored test suite; increased test coverage to 97%
|
20
|
+
- Refactored ActiveSupport::Notification integration (DRY)
|
21
|
+
### Fixed
|
22
|
+
- Add undeclared runtime dependency `version_gem`
|
23
|
+
- `DebugLogging::Hooks` integration via `extend`
|
24
|
+
- `DebugLogging::ClassNotifier` support for method signatures with kwargs
|
25
|
+
- `error_handler_proc` support for method signatures with kwargs
|
26
|
+
|
14
27
|
## [4.0.1] ([tag][4.0.1t]) - 2024-03-01
|
15
28
|
### Added
|
16
29
|
- Support for all Numeric types to be used as monotonic timestamps for ActiveSupport::Notifications
|
@@ -105,7 +118,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
105
118
|
## [0.1.0] ([tag][0.1.0t]) - 2017-03-25
|
106
119
|
- Initial release
|
107
120
|
|
108
|
-
[Unreleased]: https://gitlab.com/kettle-rb/kettle-soup-cover/-/compare/v4.0.
|
121
|
+
[Unreleased]: https://gitlab.com/kettle-rb/kettle-soup-cover/-/compare/v4.0.2...HEAD
|
122
|
+
[4.0.2t]: https://gitlab.com/pboling/debug_logging/-/tags/v4.0.2
|
123
|
+
[4.0.2]: https://gitlab.com/kettle-rb/kettle-soup-cover/-/compare/v4.0.1...v4.0.2
|
109
124
|
[4.0.1t]: https://gitlab.com/pboling/debug_logging/-/tags/v4.0.1
|
110
125
|
[4.0.1]: https://gitlab.com/kettle-rb/kettle-soup-cover/-/compare/v4.0.0...v4.0.1
|
111
126
|
[4.0.0t]: https://gitlab.com/pboling/debug_logging/-/tags/v4.0.0
|
data/CONTRIBUTING.md
CHANGED
@@ -20,7 +20,7 @@ To release a new version:
|
|
20
20
|
6. Run `git checkout main` (Or whichever branch is considered `trunk`, e.g. `master`)
|
21
21
|
7. Run `git pull origin main` to ensure you will release the latest trunk code.
|
22
22
|
8. Set `SOURCE_DATE_EPOCH` so `rake build` and `rake release` use same timestamp, and generate same checksums
|
23
|
-
a. Run `export SOURCE_DATE_EPOCH=$EPOCHSECONDS`
|
23
|
+
a. Run `export SOURCE_DATE_EPOCH=$EPOCHSECONDS && echo $SOURCE_DATE_EPOCH`
|
24
24
|
9. Run `bundle exec rake build`
|
25
25
|
10. Run [`bin/checksums`](https://github.com/rubygems/guides/pull/325) to create SHA-256 and SHA-512 checksums
|
26
26
|
a. Checksums will be committed automatically by the script, but not pushed
|
data/README.md
CHANGED
@@ -60,7 +60,7 @@ Supports `ActiveSupport::Notifications` (thanks [@jgillson](https://github.com/j
|
|
60
60
|
[✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=plastic&logo=angellist
|
61
61
|
[🐦twitter]: http://twitter.com/intent/user?screen_name=galtzo
|
62
62
|
[🐦twitter-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow%20@galtzo
|
63
|
-
[🚎blog]: http://www.railsbling.com/tags/
|
63
|
+
[🚎blog]: http://www.railsbling.com/tags/debug_logging/
|
64
64
|
[🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
|
65
65
|
[my🧪lab]: https://gitlab.com/pboling
|
66
66
|
[my🧊berg]: https://codeberg.org/pboling
|
@@ -82,6 +82,7 @@ Supports `ActiveSupport::Notifications` (thanks [@jgillson](https://github.com/j
|
|
82
82
|
* *All configuration is inheritable to, and overridable by, child classes, since v3.1.3*
|
83
83
|
* *[Class finalization hook](https://stackoverflow.com/a/34559282) (optional: `require 'debug_logging/finalize'` and `extend DebugLogging::Finalize`), since v3.1.3*
|
84
84
|
* *Error handling hooks you can use to log problems when they happen, since v3.1.7*
|
85
|
+
* *Fixed: Works with benchmarking options since v4.0.2*
|
85
86
|
* **so many free ponies** 🎠🐴🎠🐴🎠🐴
|
86
87
|
|
87
88
|
## Next Level Magic
|
@@ -89,7 +90,7 @@ Supports `ActiveSupport::Notifications` (thanks [@jgillson](https://github.com/j
|
|
89
90
|
Herein you will find:
|
90
91
|
|
91
92
|
* ~~Classes inheriting from Module~~ Refactored to use standard Modules and `prepend`!
|
92
|
-
* Zero tolerance policy on monkey patching
|
93
|
+
* Zero tolerance policy on global monkey patching
|
93
94
|
* When the gem is loaded there are no monkey patches.
|
94
95
|
* Rather, your own classes/methods get "patched" and "hooked" as you configure them.
|
95
96
|
* 100% clean, 0% obtrusive
|
@@ -166,7 +167,7 @@ DebugLogging.configuration.ellipsis = " ✂️ …".freeze
|
|
166
167
|
DebugLogging.configuration.mark_scope_exit = true # Only has an effect if benchmarking is off, since benchmarking always marks the scope exit
|
167
168
|
DebugLogging.configuration.add_payload = false # or a proc which will be called to print the payload
|
168
169
|
DebugLogging.configuration.payload_max_length = 1000
|
169
|
-
DebugLogging.configuration.error_handler_proc = nil # e.g. ->(error, config, obj, method_name, args) { config.log { "#{error.class}: #{error.message} in #{method_name}\nargs: #{args.inspect}" } }
|
170
|
+
DebugLogging.configuration.error_handler_proc = nil # e.g. ->(error, config, obj, method_name, *args, **kwargs) { config.log { "#{error.class}: #{error.message} in #{method_name}\nargs: #{args.inspect}" } }
|
170
171
|
```
|
171
172
|
|
172
173
|
If you prefer to use the block style:
|
@@ -192,7 +193,7 @@ DebugLogging.configure do |config|
|
|
192
193
|
config.mark_scope_exit = true # Only has an effect if benchmarking is off, since benchmarking always marks the scope exit
|
193
194
|
config.add_payload = false # or a proc which will be called to print the payload
|
194
195
|
config.payload_max_length = 1000
|
195
|
-
config.error_handler_proc = nil # e.g. ->(error, config, obj, method_name, args) { config.log { "#{error.class}: #{error.message} in #{method_name}\nargs: #{args.inspect}" } }
|
196
|
+
config.error_handler_proc = nil # e.g. ->(error, config, obj, method_name, *args, **kwargs) { config.log { "#{error.class}: #{error.message} in #{method_name}\nargs: #{args.inspect}" } }
|
196
197
|
end
|
197
198
|
```
|
198
199
|
|
@@ -264,6 +265,7 @@ class Car
|
|
264
265
|
logged :dealer_options, {
|
265
266
|
something: "here", # <= will be logged, and available to last_hash_to_s_proc
|
266
267
|
multiple_last_hashes: true, # <= Overrides config
|
268
|
+
error_handler_proc: nil, # NOTE: if you define the error_handler_proc inside a class like this you can use self inside the proc to refer to the class the method was called on!
|
267
269
|
}
|
268
270
|
def self.will_not_be_logged
|
269
271
|
false
|
@@ -314,7 +316,7 @@ class Car
|
|
314
316
|
mark_scope_exit: false,
|
315
317
|
add_payload: true, # Can also be a proc returning a string, which will be called when printing the payload
|
316
318
|
payload_max_length: 1_000,
|
317
|
-
error_handler_proc: nil,
|
319
|
+
error_handler_proc: nil, # NOTE: if you define the error_handler_proc inside a class like this you can use self inside the proc to refer to the instance of the class the method was called on!
|
318
320
|
time_formatter_proc: DebugLogging::Constants::DEFAULT_TIME_FORMATTER,
|
319
321
|
add_timestamp: false,
|
320
322
|
instance_benchmarks: false,
|
@@ -439,8 +441,8 @@ end
|
|
439
441
|
Run tests!
|
440
442
|
|
441
443
|
```shell
|
442
|
-
|
443
|
-
|
444
|
+
bin/setup
|
445
|
+
bin/rake
|
444
446
|
```
|
445
447
|
|
446
448
|
## Contributing
|
@@ -511,13 +513,15 @@ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright
|
|
511
513
|
[homepage]: https://github.com/pboling/debug_logging
|
512
514
|
[blogpage]: http://www.railsbling.com/tags/debug_logging/
|
513
515
|
|
514
|
-
[comment]: <> ( PERSONAL LINKS )
|
516
|
+
[comment]: <> ( 💁🏼♂️ PERSONAL LINKS )
|
515
517
|
|
516
518
|
[💁🏼♂️aboutme]: https://about.me/peter.boling
|
517
519
|
[💁🏼♂️angellist]: https://angel.co/peter-boling
|
518
520
|
[💁🏼♂️devto]: https://dev.to/galtzo
|
519
521
|
[💁🏼♂️followme]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
|
520
522
|
[💁🏼♂️twitter]: http://twitter.com/galtzo
|
523
|
+
[💁🏼♂️peterboling]: http://www.peterboling.com
|
524
|
+
[💁🏼♂️railsbling]: http://www.railsbling.com
|
521
525
|
|
522
526
|
[comment]: <> ( KEYED LINKS )
|
523
527
|
|
@@ -46,7 +46,7 @@ module DebugLogging
|
|
46
46
|
DebugLogging::Constants::EVENT_TIME_FORMATTER.call(time)
|
47
47
|
end
|
48
48
|
|
49
|
-
def debug_invocation_to_s(klass: nil, separator: nil,
|
49
|
+
def debug_invocation_to_s(klass: nil, separator: nil, decorated_method: nil, config_proxy: nil)
|
50
50
|
return "" unless config_proxy
|
51
51
|
|
52
52
|
klass_string = if config_proxy.debug_colorized_chain_for_class
|
@@ -55,9 +55,9 @@ module DebugLogging
|
|
55
55
|
klass.to_s
|
56
56
|
end
|
57
57
|
method_string = if config_proxy.debug_colorized_chain_for_method
|
58
|
-
config_proxy.debug_colorized_chain_for_method.call(ColorizedString[
|
58
|
+
config_proxy.debug_colorized_chain_for_method.call(ColorizedString[decorated_method.to_s])
|
59
59
|
else
|
60
|
-
|
60
|
+
decorated_method.to_s
|
61
61
|
end
|
62
62
|
"#{klass_string}#{separator}#{method_string}"
|
63
63
|
end
|
@@ -69,7 +69,7 @@ module DebugLogging
|
|
69
69
|
|
70
70
|
add_args_ellipsis = false
|
71
71
|
args = args.dup
|
72
|
-
args.push(kwargs) if kwargs
|
72
|
+
args.push(kwargs) if kwargs&.keys && !kwargs&.keys&.length&.zero?
|
73
73
|
if config_proxy.debug_last_hash_to_s_proc && args[-1].is_a?(Hash)
|
74
74
|
add_other_args_ellipsis = false
|
75
75
|
if args.length > 1
|
@@ -204,8 +204,8 @@ module DebugLogging
|
|
204
204
|
|
205
205
|
module_function
|
206
206
|
|
207
|
-
def debug_event_name_to_s(
|
208
|
-
"#{
|
207
|
+
def debug_event_name_to_s(decorated_method: nil)
|
208
|
+
"#{decorated_method}.log"
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
@@ -1,72 +1,42 @@
|
|
1
1
|
module DebugLogging
|
2
2
|
module ClassLogger
|
3
|
+
class << self
|
4
|
+
def extended(base)
|
5
|
+
base.extend(LambDartable::Log)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
def logged(*methods_to_log)
|
4
10
|
methods_to_log, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
|
5
11
|
method_names: methods_to_log,
|
6
12
|
payload: nil,
|
7
13
|
config: nil,
|
8
14
|
)
|
9
|
-
Array(methods_to_log).each do |
|
10
|
-
|
11
|
-
method_names:
|
15
|
+
Array(methods_to_log).each do |decorated_method|
|
16
|
+
decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
|
17
|
+
method_names: decorated_method,
|
12
18
|
payload: payload,
|
13
19
|
config: config_opts,
|
14
20
|
)
|
15
|
-
original_method = method(
|
21
|
+
original_method = method(decorated_method)
|
16
22
|
(class << self; self; end).class_eval do
|
17
|
-
define_method(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
define_method(decorated_method) do |*args, **kwargs, &block|
|
24
|
+
lamb_dart = LambDart::Log.new(
|
25
|
+
klass: self,
|
26
|
+
method_config_opts:,
|
27
|
+
method_payload:,
|
28
|
+
args:,
|
29
|
+
kwargs:,
|
30
|
+
decorated_method:,
|
23
31
|
)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
separator: "::",
|
33
|
-
method_to_log: method_to_log,
|
34
|
-
config_proxy: config_proxy,
|
35
|
-
)
|
36
|
-
invocation_id = debug_invocation_id_to_s(args: args, config_proxy: config_proxy)
|
37
|
-
signature = debug_signature_to_s(args: args, config_proxy: config_proxy)
|
38
|
-
paymud = debug_payload_to_s(payload: paydirt, config_proxy: config_proxy)
|
39
|
-
"#{log_prefix}#{signature}#{invocation_id} debug: #{paymud}"
|
40
|
-
end
|
41
|
-
if config_proxy.benchmarkable_for?(:debug_class_benchmarks)
|
42
|
-
tms = Benchmark.measure do
|
43
|
-
method_return_value = if args.size == 1 && (harsh = args[0]) && harsh.is_a?(Hash)
|
44
|
-
original_method.call(**harsh, &block)
|
45
|
-
else
|
46
|
-
original_method.call(*args, &block)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
config_proxy.log do
|
50
|
-
"#{log_prefix} #{debug_benchmark_to_s(tms: tms)}#{invocation_id}"
|
51
|
-
end
|
52
|
-
else
|
53
|
-
method_return_value = if args.size == 1 && (harsh = args[0]) && harsh.is_a?(Hash)
|
54
|
-
original_method.call(**harsh, &block)
|
55
|
-
else
|
56
|
-
original_method.call(*args, &block)
|
57
|
-
end
|
58
|
-
if config_proxy.exit_scope_markable? && invocation_id && !invocation_id.empty?
|
59
|
-
config_proxy.log do
|
60
|
-
"#{log_prefix} completed#{invocation_id}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
method_return_value
|
65
|
-
rescue StandardError => e
|
66
|
-
if config_proxy.error_handler_proc
|
67
|
-
config_proxy.error_handler_proc.call(config_proxy, e, self, method_to_log, args)
|
68
|
-
else
|
69
|
-
raise e
|
32
|
+
real_mccoy = ->() {
|
33
|
+
original_method.call(*args, **kwargs, &block)
|
34
|
+
}
|
35
|
+
_dl_ld_enter_log(lamb_dart) do
|
36
|
+
_dl_ld_error_handle(lamb_dart) do
|
37
|
+
return _dl_ld_benchmarked(lamb_dart) { real_mccoy.call } if lamb_dart.bench?
|
38
|
+
|
39
|
+
_dl_ld_exit_log(lamb_dart) { real_mccoy.call }
|
70
40
|
end
|
71
41
|
end
|
72
42
|
end
|
@@ -1,53 +1,37 @@
|
|
1
1
|
module DebugLogging
|
2
2
|
module ClassNotifier
|
3
|
+
class << self
|
4
|
+
def extended(base)
|
5
|
+
base.extend(LambDartable::Note)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
def notified(*methods_to_notify)
|
4
10
|
methods_to_notify, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
|
5
11
|
method_names: methods_to_notify,
|
6
12
|
payload: nil,
|
7
13
|
config: nil,
|
8
14
|
)
|
9
|
-
Array(methods_to_notify).each do |
|
10
|
-
|
11
|
-
method_names:
|
15
|
+
Array(methods_to_notify).each do |decorated_method|
|
16
|
+
decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
|
17
|
+
method_names: decorated_method,
|
12
18
|
payload: payload,
|
13
19
|
config: config_opts,
|
14
20
|
)
|
15
|
-
original_method = method(
|
21
|
+
original_method = method(decorated_method)
|
16
22
|
(class << self; self; end).class_eval do
|
17
|
-
define_method(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: self, payload: method_payload)
|
33
|
-
ActiveSupport::Notifications.instrument(
|
34
|
-
DebugLogging::ArgumentPrinter.debug_event_name_to_s(method_to_notify: method_to_notify),
|
35
|
-
{
|
36
|
-
debug_args: args,
|
37
|
-
config_proxy: config_proxy,
|
38
|
-
**paydirt,
|
39
|
-
},
|
40
|
-
) do
|
41
|
-
if args.size == 1 && (harsh = args[0]) && harsh.is_a?(Hash)
|
42
|
-
original_method.call(**harsh, &block)
|
43
|
-
else
|
44
|
-
original_method.call(*args, &block)
|
45
|
-
end
|
46
|
-
rescue StandardError => e
|
47
|
-
if config_proxy.error_handler_proc
|
48
|
-
config_proxy.error_handler_proc.call(config_proxy, e, self, method_to_notify, args)
|
49
|
-
else
|
50
|
-
raise e
|
23
|
+
define_method(decorated_method) do |*args, **kwargs, &block|
|
24
|
+
lamb_dart = LambDart::Note.new(
|
25
|
+
klass: self,
|
26
|
+
method_config_opts:,
|
27
|
+
method_payload:,
|
28
|
+
args:,
|
29
|
+
kwargs:,
|
30
|
+
decorated_method:,
|
31
|
+
)
|
32
|
+
_dl_ld_notify(lamb_dart) do
|
33
|
+
_dl_ld_error_handle(lamb_dart) do
|
34
|
+
original_method.call(*args, **kwargs, &block)
|
51
35
|
end
|
52
36
|
end
|
53
37
|
end
|
@@ -38,11 +38,11 @@ module DebugLogging
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class << self
|
41
|
-
def config_pointer(type,
|
41
|
+
def config_pointer(type, decorated_method)
|
42
42
|
# Methods names that do not match the following regex can't be part of an ivar name
|
43
43
|
# /[a-zA-Z_][a-zA-Z0-9_]*/
|
44
44
|
# Thus we have to use a different form of the method name that is compatible with ivar name conventions
|
45
|
-
"@debug_logging_config_#{type}_#{Digest::MD5.hexdigest(
|
45
|
+
"@debug_logging_config_#{type}_#{Digest::MD5.hexdigest(decorated_method.to_s)}".to_sym
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
data/lib/debug_logging/hooks.rb
CHANGED
@@ -3,12 +3,14 @@ require "timeout"
|
|
3
3
|
|
4
4
|
module DebugLogging
|
5
5
|
module Hooks
|
6
|
-
|
7
|
-
mod
|
8
|
-
|
6
|
+
class << self
|
7
|
+
def included(mod)
|
8
|
+
mod.extend(ClassMethods)
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
def extended(mod)
|
12
|
+
mod.extend(ClassMethods)
|
13
|
+
end
|
12
14
|
end
|
13
15
|
|
14
16
|
module ClassMethods
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module DebugLogging
|
2
2
|
module InstanceLogger
|
3
|
+
class << self
|
4
|
+
def extended(base)
|
5
|
+
base.include(LambDartable::Log)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
# NOTE: These params can be passed in / hidden in a last hash of *args
|
4
10
|
# NOTE: They can also be passed in discretely for each method, by passing *args as an array of arrays
|
5
11
|
# TODO: Refactor to use modern Ruby 3 *args, **kwargs instead
|
@@ -29,9 +35,9 @@ module DebugLogging
|
|
29
35
|
config: nil,
|
30
36
|
)
|
31
37
|
instance_method_modules =
|
32
|
-
Array(methods_to_log).map do |
|
38
|
+
Array(methods_to_log).map do |decorated_method|
|
33
39
|
DebugLogging::InstanceLoggerModulizer.to_mod(
|
34
|
-
methods_to_log: Array(
|
40
|
+
methods_to_log: Array(decorated_method),
|
35
41
|
payload: payload,
|
36
42
|
config: config_opts,
|
37
43
|
)
|
@@ -8,61 +8,31 @@ module DebugLogging
|
|
8
8
|
payload:,
|
9
9
|
config:,
|
10
10
|
)
|
11
|
-
Array(methods_to_log).each do |
|
12
|
-
|
13
|
-
method_names:
|
11
|
+
Array(methods_to_log).each do |decorated_method|
|
12
|
+
decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
|
13
|
+
method_names: decorated_method,
|
14
14
|
payload:,
|
15
15
|
config: config_opts,
|
16
16
|
)
|
17
|
-
define_method(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
define_method(decorated_method) do |*args, **kwargs, &block|
|
18
|
+
lamb_dart = LambDart::Log.new(
|
19
|
+
instance: self,
|
20
|
+
method_config_opts:,
|
21
|
+
method_payload:,
|
22
|
+
args:,
|
23
|
+
kwargs:,
|
24
|
+
decorated_method:,
|
24
25
|
)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
invocation_id = self.class.debug_invocation_id_to_s(args:, kwargs:, start_at:, config_proxy:)
|
34
|
-
config_proxy.log do
|
35
|
-
paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: self, payload: method_payload)
|
36
|
-
signature = self.class.debug_signature_to_s(args:, kwargs:, config_proxy:)
|
37
|
-
paymud = debug_payload_to_s(payload: paydirt, config_proxy:)
|
38
|
-
"#{start_timestamp}#{log_prefix}#{signature}#{invocation_id} debug: #{paymud}"
|
39
|
-
end
|
40
|
-
if config_proxy.benchmarkable_for?(:debug_instance_benchmarks)
|
41
|
-
tms = Benchmark.measure do
|
42
|
-
method_return_value = super(*args, **kwargs, &block)
|
43
|
-
end
|
44
|
-
end_timestamp = self.class.debug_time_to_s(Time.now, config_proxy:)
|
45
|
-
config_proxy.log do
|
46
|
-
"#{end_timestamp}#{log_prefix} #{self.class.debug_benchmark_to_s(tms: tms)}#{invocation_id}"
|
47
|
-
end
|
48
|
-
else
|
49
|
-
begin
|
50
|
-
method_return_value = super(*args, **kwargs, &block)
|
51
|
-
rescue StandardError => e
|
52
|
-
if config_proxy.error_handler_proc
|
53
|
-
config_proxy.error_handler_proc.call(config_proxy, e, self, method_to_log, args, kwargs)
|
54
|
-
else
|
55
|
-
raise e
|
56
|
-
end
|
57
|
-
end
|
58
|
-
if config_proxy.exit_scope_markable? && invocation_id && !invocation_id.empty?
|
59
|
-
end_timestamp = self.class.debug_time_to_s(Time.now, config_proxy:)
|
60
|
-
config_proxy.log do
|
61
|
-
"#{end_timestamp}#{log_prefix} completed#{invocation_id}"
|
62
|
-
end
|
26
|
+
real_mccoy = ->() {
|
27
|
+
super(*args, **kwargs, &block)
|
28
|
+
}
|
29
|
+
_dl_ld_enter_log(lamb_dart) do
|
30
|
+
_dl_ld_error_handle(lamb_dart) do
|
31
|
+
return _dl_ld_benchmarked(lamb_dart) { real_mccoy.call } if lamb_dart.bench?
|
32
|
+
|
33
|
+
_dl_ld_exit_log(lamb_dart) { real_mccoy.call }
|
63
34
|
end
|
64
35
|
end
|
65
|
-
method_return_value
|
66
36
|
end
|
67
37
|
end
|
68
38
|
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module DebugLogging
|
2
2
|
module InstanceNotifier
|
3
|
+
class << self
|
4
|
+
def extended(base)
|
5
|
+
base.include(LambDartable::Note)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
def i_notified(*methods_to_log)
|
4
10
|
method_names, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
|
5
11
|
method_names: methods_to_log,
|
@@ -8,40 +8,24 @@ module DebugLogging
|
|
8
8
|
payload:,
|
9
9
|
config:,
|
10
10
|
)
|
11
|
-
Array(methods_to_notify).each do |
|
12
|
-
|
13
|
-
method_names:
|
11
|
+
Array(methods_to_notify).each do |decorated_method|
|
12
|
+
decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
|
13
|
+
method_names: decorated_method,
|
14
14
|
payload:,
|
15
15
|
config: config_opts,
|
16
16
|
)
|
17
|
-
define_method(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: self, payload: method_payload)
|
33
|
-
ActiveSupport::Notifications.instrument(
|
34
|
-
DebugLogging::ArgumentPrinter.debug_event_name_to_s(method_to_notify:),
|
35
|
-
debug_args: kwargs.empty? ? args : args + [kwargs],
|
36
|
-
config_proxy: config_proxy,
|
37
|
-
**paydirt,
|
38
|
-
) do
|
39
|
-
super(*args, **kwargs, &block)
|
40
|
-
rescue StandardError => e
|
41
|
-
if config_proxy.error_handler_proc
|
42
|
-
config_proxy.error_handler_proc.call(config_proxy, e, self, method_to_notify, args, kwargs)
|
43
|
-
else
|
44
|
-
raise e
|
17
|
+
define_method(decorated_method) do |*args, **kwargs, &block|
|
18
|
+
lamb_dart = LambDart::Note.new(
|
19
|
+
instance: self,
|
20
|
+
method_config_opts:,
|
21
|
+
method_payload:,
|
22
|
+
args:,
|
23
|
+
kwargs:,
|
24
|
+
decorated_method:,
|
25
|
+
)
|
26
|
+
_dl_ld_notify(lamb_dart) do
|
27
|
+
_dl_ld_error_handle(lamb_dart) do
|
28
|
+
super(*args, **kwargs, &block)
|
45
29
|
end
|
46
30
|
end
|
47
31
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module DebugLogging
|
4
|
+
module LambDart
|
5
|
+
class Base
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
attr_reader :instance, # For ClassLogger, this will be the same as klass
|
9
|
+
:klass,
|
10
|
+
:is_class,
|
11
|
+
:config_proxy,
|
12
|
+
:method_payload,
|
13
|
+
:args,
|
14
|
+
:kwargs,
|
15
|
+
:scope_term,
|
16
|
+
:decorated_method
|
17
|
+
|
18
|
+
def_delegator :@config_proxy, :error_handler_proc
|
19
|
+
|
20
|
+
def initialize(instance: nil, klass: nil, method_config_opts:, method_payload:, args:, kwargs:, decorated_method:)
|
21
|
+
@instance = instance || klass
|
22
|
+
@klass = klass || instance.class
|
23
|
+
@method_payload = method_payload
|
24
|
+
@args = args
|
25
|
+
@kwargs = kwargs
|
26
|
+
@decorated_method = decorated_method
|
27
|
+
@is_class = (self.klass == self.instance)
|
28
|
+
@scope_term = is_class ? "class" : "instance"
|
29
|
+
@config_proxy = DebugLogging::Util.config_proxy_finder(
|
30
|
+
scope: self.klass,
|
31
|
+
config_opts: method_config_opts,
|
32
|
+
method_name: self.decorated_method,
|
33
|
+
proxy_ref:,
|
34
|
+
) do |proxy|
|
35
|
+
yield proxy if block_given?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def proxy_ref
|
42
|
+
raise "#{self.class}##{__method__} is not defined, please fix!"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module DebugLogging
|
2
|
+
module LambDart
|
3
|
+
class Log < Base
|
4
|
+
attr_reader :log_prefix,
|
5
|
+
:invocation_id,
|
6
|
+
:start_at
|
7
|
+
|
8
|
+
def initialize(...)
|
9
|
+
@start_at = Time.now
|
10
|
+
super
|
11
|
+
@log_prefix = klass.debug_invocation_to_s(
|
12
|
+
klass: klass.to_s,
|
13
|
+
separator: is_class ? "::" : "#",
|
14
|
+
decorated_method:,
|
15
|
+
config_proxy:,
|
16
|
+
)
|
17
|
+
@invocation_id = klass.debug_invocation_id_to_s(args:, config_proxy:)
|
18
|
+
end
|
19
|
+
|
20
|
+
def end_timestamp
|
21
|
+
klass.debug_time_to_s(Time.now, config_proxy:)
|
22
|
+
end
|
23
|
+
|
24
|
+
def benchmarked(tms)
|
25
|
+
klass.debug_benchmark_to_s(tms: tms)
|
26
|
+
end
|
27
|
+
|
28
|
+
def mark_exit_scope?
|
29
|
+
config_proxy.exit_scope_markable? && invocation_id && !invocation_id.empty?
|
30
|
+
end
|
31
|
+
|
32
|
+
def bench_scope
|
33
|
+
"debug_#{scope_term}_benchmarks".to_sym
|
34
|
+
end
|
35
|
+
|
36
|
+
def bench?
|
37
|
+
config_proxy.benchmarkable_for?(bench_scope)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def proxy_ref
|
43
|
+
is_class ? "kl" : "ilm"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module DebugLogging
|
2
|
+
module LambDart
|
3
|
+
class Note < Base
|
4
|
+
attr_reader :debug_args
|
5
|
+
|
6
|
+
def initialize(...)
|
7
|
+
super do |proxy|
|
8
|
+
subscribe(proxy)
|
9
|
+
end
|
10
|
+
@debug_args = kwargs.empty? ? args : args + [kwargs]
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def subscribe(proxy)
|
16
|
+
ActiveSupport::Notifications.subscribe(
|
17
|
+
DebugLogging::ArgumentPrinter.debug_event_name_to_s(decorated_method: decorated_method),
|
18
|
+
) do |*subscribe_args|
|
19
|
+
proxy.log do
|
20
|
+
DebugLogging::LogSubscriber.log_event(ActiveSupport::Notifications::Event.new(*subscribe_args))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def proxy_ref
|
26
|
+
is_class ? "kn" : "inm"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require_relative "lamb_darts/benchmarked"
|
2
|
+
require_relative "lamb_darts/enter_log"
|
3
|
+
require_relative "lamb_darts/error_handle"
|
4
|
+
require_relative "lamb_darts/exit_log"
|
5
|
+
require_relative "lamb_darts/notify"
|
6
|
+
|
7
|
+
module DebugLogging
|
8
|
+
module LambDartable
|
9
|
+
module Log
|
10
|
+
class << self
|
11
|
+
def included(base)
|
12
|
+
base.include(LambDarts::Benchmarked)
|
13
|
+
base.include(LambDarts::EnterLog)
|
14
|
+
base.include(LambDarts::ErrorHandle)
|
15
|
+
base.include(LambDarts::ExitLog)
|
16
|
+
end
|
17
|
+
|
18
|
+
def extended(base)
|
19
|
+
base.extend(LambDarts::Benchmarked)
|
20
|
+
base.extend(LambDarts::EnterLog)
|
21
|
+
base.extend(LambDarts::ErrorHandle)
|
22
|
+
base.extend(LambDarts::ExitLog)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
module Note
|
28
|
+
class << self
|
29
|
+
def included(base)
|
30
|
+
base.include(LambDarts::ErrorHandle)
|
31
|
+
base.include(LambDarts::Notify)
|
32
|
+
end
|
33
|
+
|
34
|
+
def extended(base)
|
35
|
+
base.extend(LambDarts::ErrorHandle)
|
36
|
+
base.extend(LambDarts::Notify)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module DebugLogging
|
2
|
+
module LambDarts
|
3
|
+
module Benchmarked
|
4
|
+
def _dl_ld_benchmarked(ld)
|
5
|
+
brv = nil
|
6
|
+
# Benchmarking as close to the real mccoy as possible,
|
7
|
+
# so as to not pollute performance tracking with the effects of debug_logging,
|
8
|
+
# which may be removed once data has been gathered, or turned off.
|
9
|
+
tms = Benchmark.measure do
|
10
|
+
brv = yield
|
11
|
+
end
|
12
|
+
ld.config_proxy.log do
|
13
|
+
"#{ld.end_timestamp}#{ld.log_prefix} #{ld.benchmarked(tms)}#{ld.invocation_id}"
|
14
|
+
end
|
15
|
+
brv
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DebugLogging
|
2
|
+
module LambDarts
|
3
|
+
module EnterLog
|
4
|
+
def _dl_ld_enter_log(ld)
|
5
|
+
start_timestamp = ld.klass.debug_time_to_s(ld.start_at, config_proxy: ld.config_proxy)
|
6
|
+
ld.config_proxy.log do
|
7
|
+
paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: ld.instance, payload: ld.method_payload)
|
8
|
+
signature = ld.klass.debug_signature_to_s(args: ld.args, kwargs: ld.kwargs, config_proxy: ld.config_proxy)
|
9
|
+
paymud = ld.instance.debug_payload_to_s(payload: paydirt, config_proxy: ld.config_proxy)
|
10
|
+
"#{start_timestamp}#{ld.log_prefix}#{signature}#{ld.invocation_id} debug: #{paymud}"
|
11
|
+
end
|
12
|
+
yield
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module DebugLogging
|
2
|
+
module LambDarts
|
3
|
+
module ErrorHandle
|
4
|
+
def _dl_ld_error_handle(ld)
|
5
|
+
if ld.config_proxy.error_handler_proc
|
6
|
+
begin
|
7
|
+
yield
|
8
|
+
rescue StandardError => e
|
9
|
+
if ld.error_handler_proc
|
10
|
+
ld.error_handler_proc.call(
|
11
|
+
ld.config_proxy,
|
12
|
+
e,
|
13
|
+
self,
|
14
|
+
ld.decorated_method,
|
15
|
+
*ld.args,
|
16
|
+
**ld.kwargs,
|
17
|
+
)
|
18
|
+
else
|
19
|
+
raise e
|
20
|
+
end
|
21
|
+
end
|
22
|
+
else
|
23
|
+
yield
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module DebugLogging
|
2
|
+
module LambDarts
|
3
|
+
module ExitLog
|
4
|
+
def _dl_ld_exit_log(ld)
|
5
|
+
hrv = yield
|
6
|
+
return hrv unless ld.mark_exit_scope?
|
7
|
+
|
8
|
+
ld.config_proxy.log do
|
9
|
+
"#{ld.end_timestamp}#{ld.log_prefix} completed#{ld.invocation_id}"
|
10
|
+
end
|
11
|
+
hrv
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module DebugLogging
|
2
|
+
module LambDarts
|
3
|
+
module Notify
|
4
|
+
def _dl_ld_notify(ld)
|
5
|
+
paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: ld.instance, payload: ld.method_payload)
|
6
|
+
ActiveSupport::Notifications.instrument(
|
7
|
+
DebugLogging::ArgumentPrinter.debug_event_name_to_s(decorated_method: ld.decorated_method),
|
8
|
+
debug_args: ld.debug_args,
|
9
|
+
config_proxy: ld.config_proxy,
|
10
|
+
**paydirt,
|
11
|
+
) do
|
12
|
+
yield
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/debug_logging/util.rb
CHANGED
@@ -71,27 +71,31 @@ module DebugLogging
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def config_proxy_finder(scope:, method_name:, proxy_ref:, config_opts: {}, &block)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
proxy = scope.send(
|
75
|
+
:instance_variable_get,
|
76
|
+
DebugLogging::Configuration.config_pointer(
|
77
|
+
proxy_ref,
|
78
|
+
method_name,
|
79
|
+
),
|
80
|
+
)
|
81
|
+
# short circuit on subsequent calls is required
|
82
|
+
# so we only register notifications once
|
83
|
+
return proxy if proxy
|
84
|
+
|
85
|
+
base = scope.respond_to?(:debug_config) ? scope.debug_config : DebugLogging.debug_logging_configuration
|
86
|
+
proxy = if config_opts.empty?
|
87
|
+
base
|
79
88
|
else
|
80
|
-
base
|
81
|
-
proxy = if config_opts.empty?
|
82
|
-
base
|
83
|
-
else
|
84
|
-
DebugLogging::Configuration.new(**base.to_hash.merge(config_opts))
|
85
|
-
end
|
86
|
-
proxy.register(method_name)
|
87
|
-
scope.send(
|
88
|
-
:instance_variable_set,
|
89
|
-
DebugLogging::Configuration.config_pointer(proxy_ref, method_name),
|
90
|
-
proxy,
|
91
|
-
)
|
92
|
-
yield proxy if block
|
93
|
-
proxy
|
89
|
+
DebugLogging::Configuration.new(**base.to_hash.merge(config_opts))
|
94
90
|
end
|
91
|
+
proxy.register(method_name)
|
92
|
+
scope.send(
|
93
|
+
:instance_variable_set,
|
94
|
+
DebugLogging::Configuration.config_pointer(proxy_ref, method_name),
|
95
|
+
proxy,
|
96
|
+
)
|
97
|
+
yield proxy if block
|
98
|
+
proxy
|
95
99
|
end
|
96
100
|
end
|
97
101
|
end
|
data/lib/debug_logging.rb
CHANGED
@@ -15,17 +15,12 @@ require "debug_logging/util"
|
|
15
15
|
require "debug_logging/finalize"
|
16
16
|
require "debug_logging/argument_printer"
|
17
17
|
require "debug_logging/hooks"
|
18
|
+
require "debug_logging/lamb_dart"
|
19
|
+
require "debug_logging/lamb_dartable"
|
18
20
|
require "debug_logging/instance_logger_modulizer"
|
19
21
|
require "debug_logging/instance_logger"
|
20
22
|
require "debug_logging/class_logger"
|
21
23
|
|
22
|
-
####################
|
23
|
-
# #
|
24
|
-
# NOTE: The manner this is made to work for class methods is totally different
|
25
|
-
# than the way this is made to work for instance methods.
|
26
|
-
# NOTE: The instance method manner works on Ruby 2.0+
|
27
|
-
# NOTE: The class method manner works on Ruby 2.1+
|
28
|
-
# #
|
29
24
|
####################
|
30
25
|
# #
|
31
26
|
# USAGE (see specs)#
|
data/lib/simple_debug_logging.rb
CHANGED
@@ -49,17 +49,17 @@ class SimpleDebugLogging < Module
|
|
49
49
|
|
50
50
|
module ClassMethodLogger
|
51
51
|
def logged(*methods_to_log)
|
52
|
-
methods_to_log.each do |
|
53
|
-
original_method = method(
|
52
|
+
methods_to_log.each do |decorated_method|
|
53
|
+
original_method = method(decorated_method)
|
54
54
|
(class << self; self; end).class_eval do
|
55
|
-
define_method(
|
55
|
+
define_method(decorated_method.to_sym) do |*args|
|
56
56
|
method_return_value = nil
|
57
57
|
invocation_id = " ~#{args.object_id}@#{Time.now.to_i}~" if args
|
58
|
-
puts "#{self}::#{
|
58
|
+
puts "#{self}::#{decorated_method}(#{args.map(&:inspect).join(", ")})#{invocation_id}"
|
59
59
|
elapsed = Benchmark.realtime do
|
60
60
|
method_return_value = original_method.call(*args)
|
61
61
|
end
|
62
|
-
puts "#{self}::#{
|
62
|
+
puts "#{self}::#{decorated_method} ~#{args.hash}~ complete in #{elapsed}s#{invocation_id}"
|
63
63
|
method_return_value
|
64
64
|
end
|
65
65
|
end
|
@@ -68,18 +68,20 @@ class SimpleDebugLogging < Module
|
|
68
68
|
end
|
69
69
|
|
70
70
|
module InstanceMethodLoggerModulizer
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
71
|
+
class << self
|
72
|
+
def to_mod(methods_to_log = [])
|
73
|
+
Module.new do
|
74
|
+
Array(methods_to_log).each do |decorated_method|
|
75
|
+
define_method(decorated_method.to_sym) do |*args, &block|
|
76
|
+
method_return_value = nil
|
77
|
+
invocation_id = " ~#{args.object_id}@#{Time.now.to_i}~" if args
|
78
|
+
puts "#{self.class}##{decorated_method}(#{args.map(&:inspect).join(", ")})#{invocation_id}"
|
79
|
+
elapsed = Benchmark.realtime do
|
80
|
+
method_return_value = super(*args, &block)
|
81
|
+
end
|
82
|
+
puts "#{self.class}##{decorated_method} ~#{args.hash}~ complete in #{elapsed}s#{invocation_id}"
|
83
|
+
method_return_value
|
80
84
|
end
|
81
|
-
puts "#{self.class}##{method_to_log} ~#{args.hash}~ complete in #{elapsed}s#{invocation_id}"
|
82
|
-
method_return_value
|
83
85
|
end
|
84
86
|
end
|
85
87
|
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.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
@@ -38,7 +38,7 @@ cert_chain:
|
|
38
38
|
KuxrfYrN+9HvMdm+nZ6TypmKftHY3Gj+/uu+g8Icm/zrvTWAEE0mcJOkfrIoNPJb
|
39
39
|
pF8dMA==
|
40
40
|
-----END CERTIFICATE-----
|
41
|
-
date: 2024-
|
41
|
+
date: 2024-05-12 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: colorize
|
@@ -55,33 +55,53 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: version_gem
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.1'
|
61
64
|
- - ">="
|
62
65
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
-
type: :
|
66
|
+
version: 1.1.4
|
67
|
+
type: :runtime
|
65
68
|
prerelease: false
|
66
69
|
version_requirements: !ruby/object:Gem::Requirement
|
67
70
|
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '1.1'
|
68
74
|
- - ">="
|
69
75
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
76
|
+
version: 1.1.4
|
71
77
|
- !ruby/object:Gem::Dependency
|
72
78
|
name: rake
|
73
79
|
requirement: !ruby/object:Gem::Requirement
|
74
80
|
requirements:
|
75
81
|
- - ">="
|
76
82
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
83
|
+
version: 13.2.1
|
84
|
+
type: :development
|
85
|
+
prerelease: false
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 13.2.1
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: activesupport
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 5.2.4.4
|
78
98
|
type: :development
|
79
99
|
prerelease: false
|
80
100
|
version_requirements: !ruby/object:Gem::Requirement
|
81
101
|
requirements:
|
82
102
|
- - ">="
|
83
103
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
104
|
+
version: 5.2.4.4
|
85
105
|
- !ruby/object:Gem::Dependency
|
86
106
|
name: kettle-soup-cover
|
87
107
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,6 +224,26 @@ dependencies:
|
|
204
224
|
- - "~>"
|
205
225
|
- !ruby/object:Gem::Version
|
206
226
|
version: '2.25'
|
227
|
+
- !ruby/object:Gem::Dependency
|
228
|
+
name: standard-rubocop-lts
|
229
|
+
requirement: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - "~>"
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '1.0'
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 1.0.10
|
237
|
+
type: :development
|
238
|
+
prerelease: false
|
239
|
+
version_requirements: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '1.0'
|
244
|
+
- - ">="
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 1.0.10
|
207
247
|
- !ruby/object:Gem::Dependency
|
208
248
|
name: rspec
|
209
249
|
requirement: !ruby/object:Gem::Requirement
|
@@ -310,6 +350,16 @@ files:
|
|
310
350
|
- lib/debug_logging/instance_logger_modulizer.rb
|
311
351
|
- lib/debug_logging/instance_notifier.rb
|
312
352
|
- lib/debug_logging/instance_notifier_modulizer.rb
|
353
|
+
- lib/debug_logging/lamb_dart.rb
|
354
|
+
- lib/debug_logging/lamb_dart/base.rb
|
355
|
+
- lib/debug_logging/lamb_dart/log.rb
|
356
|
+
- lib/debug_logging/lamb_dart/note.rb
|
357
|
+
- lib/debug_logging/lamb_dartable.rb
|
358
|
+
- lib/debug_logging/lamb_darts/benchmarked.rb
|
359
|
+
- lib/debug_logging/lamb_darts/enter_log.rb
|
360
|
+
- lib/debug_logging/lamb_darts/error_handle.rb
|
361
|
+
- lib/debug_logging/lamb_darts/exit_log.rb
|
362
|
+
- lib/debug_logging/lamb_darts/notify.rb
|
313
363
|
- lib/debug_logging/log_subscriber.rb
|
314
364
|
- lib/debug_logging/util.rb
|
315
365
|
- lib/debug_logging/version.rb
|
@@ -319,10 +369,10 @@ licenses:
|
|
319
369
|
- MIT
|
320
370
|
metadata:
|
321
371
|
homepage_uri: https://github.com/pboling/debug_logging
|
322
|
-
source_code_uri: https://github.com/pboling/debug_logging/tree/v4.0.
|
323
|
-
changelog_uri: https://github.com/pboling/debug_logging/blob/v4.0.
|
372
|
+
source_code_uri: https://github.com/pboling/debug_logging/tree/v4.0.2
|
373
|
+
changelog_uri: https://github.com/pboling/debug_logging/blob/v4.0.2/CHANGELOG.md
|
324
374
|
bug_tracker_uri: https://github.com/pboling/debug_logging/issues
|
325
|
-
documentation_uri: https://www.rubydoc.info/gems/debug_logging/4.0.
|
375
|
+
documentation_uri: https://www.rubydoc.info/gems/debug_logging/4.0.2
|
326
376
|
wiki_uri: https://github.com/pboling/debug_logging/wiki
|
327
377
|
funding_uri: https://liberapay.com/pboling
|
328
378
|
rubygems_mfa_required: 'true'
|
@@ -341,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
391
|
- !ruby/object:Gem::Version
|
342
392
|
version: '0'
|
343
393
|
requirements: []
|
344
|
-
rubygems_version: 3.5.
|
394
|
+
rubygems_version: 3.5.9
|
345
395
|
signing_key:
|
346
396
|
specification_version: 4
|
347
397
|
summary: Drop-in debug logging useful when a call stack gets unruly
|
metadata.gz.sig
CHANGED
Binary file
|