debug_logging 3.1.7 → 3.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CONTRIBUTING.md +47 -0
- data/LICENSE.txt +21 -0
- data/README.md +152 -76
- data/SECURITY.md +16 -0
- data/lib/debug_logging/active_support_notifications.rb +4 -4
- data/lib/debug_logging/argument_printer.rb +102 -86
- data/lib/debug_logging/class_logger.rb +21 -17
- data/lib/debug_logging/class_notifier.rb +10 -10
- data/lib/debug_logging/configuration.rb +4 -4
- data/lib/debug_logging/constants.rb +3 -3
- data/lib/debug_logging/finalize.rb +1 -1
- data/lib/debug_logging/hooks.rb +11 -11
- data/lib/debug_logging/instance_logger.rb +5 -3
- data/lib/debug_logging/instance_logger_modulizer.rb +13 -9
- data/lib/debug_logging/instance_notifier.rb +5 -3
- data/lib/debug_logging/instance_notifier_modulizer.rb +13 -9
- data/lib/debug_logging/log_subscriber.rb +6 -5
- data/lib/debug_logging/util.rb +18 -13
- data/lib/debug_logging/version.rb +3 -1
- data/lib/debug_logging.rb +24 -15
- data/lib/simple_debug_logging.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +153 -55
- metadata.gz.sig +0 -0
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -13
- data/.rspec +0 -2
- data/.rubocop.yml +0 -107
- data/.rubocop_todo.yml +0 -167
- data/.travis.yml +0 -36
- data/Gemfile +0 -12
- data/Rakefile +0 -8
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/debug_logging.gemspec +0 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa662bcddf205eef8f90245f0bafca22c5bf819695b1e51565a72d450690753e
|
4
|
+
data.tar.gz: 17f65e90f2d8bce05196cd59ae29a5632cf797a926fb54daa7072f4596ed4e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae5ebb456f043eaffd6f80a460f709d86a19b420bcf8a22ee717ad864bfe0b51abaddcaf2f9dfc431db022473be67a326eb3f7776ee7bd27ebd924b2cb812bd3
|
7
|
+
data.tar.gz: 8acb9095d4534a87fd020329fff34d20e243b56ccf39bb84d1d0424b7a8fccda17ef9e4f6b80ddbe3d0a8a858b8fec8ed491cc7e386319f9d7cd31228baa565e
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
## Contributing
|
2
|
+
|
3
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/debug_logging][🚎src-main]
|
4
|
+
. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
|
5
|
+
the [code of conduct][🤝conduct].
|
6
|
+
|
7
|
+
To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request
|
8
|
+
and post a message to the [gitter chat][🏘chat].
|
9
|
+
|
10
|
+
## Release
|
11
|
+
|
12
|
+
To release a new version:
|
13
|
+
|
14
|
+
1. Run `bin/setup && bin/rake` as a tests, coverage, & linting sanity check
|
15
|
+
2. Update the version number in `version.rb`
|
16
|
+
3. Run `bin/setup && bin/rake` again as a secondary check, and to update `Gemfile.lock`
|
17
|
+
4. Run `git commit -am "🔖 Prepare release v<VERSION>"` to commit the changes
|
18
|
+
5. Run `git push` to trigger the final CI pipeline before release, & merge PRs
|
19
|
+
a. NOTE: Remember to [check the build][🧪build]!
|
20
|
+
6. Run `git checkout main` (Or whichever branch is considered `trunk`, e.g. `master`)
|
21
|
+
7. Run `git pull origin main` to ensure you will release the latest trunk code.
|
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`
|
24
|
+
9. Run `bundle exec rake build`
|
25
|
+
10. Run [`bin/checksums`](https://github.com/rubygems/guides/pull/325) to create SHA-256 and SHA-512 checksums
|
26
|
+
a. Checksums will be committed automatically by the script, but not pushed
|
27
|
+
11. Run `bundle exec rake release` which will create a git tag for the version,
|
28
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org][💎rubygems]
|
29
|
+
|
30
|
+
NOTE: You will need to have a public key in `certs/`, and list your cert in the
|
31
|
+
`gemspec`, in order to sign the new release.
|
32
|
+
See: [RubyGems Security Guide][🔒️rubygems-security-guide]
|
33
|
+
|
34
|
+
## Contributors
|
35
|
+
|
36
|
+
[![Contributors](https://contrib.rocks/image?repo=pboling/debug_logging)][🖐contributors]
|
37
|
+
|
38
|
+
Made with [contributors-img][🖐contrib-rocks].
|
39
|
+
|
40
|
+
[🧪build]: https://github.com/pboling/debug_logging/actions
|
41
|
+
[🏘chat]: https://matrix.to/#/%23pboling_debug_logging:gitter.im
|
42
|
+
[🤝conduct]: https://github.com/pboling/debug_logging/blob/main/CODE_OF_CONDUCT.md
|
43
|
+
[🖐contrib-rocks]: https://contrib.rocks
|
44
|
+
[🖐contributors]: https://github.com/pboling/debug_logging/graphs/contributors
|
45
|
+
[💎rubygems]: https://rubygems.org
|
46
|
+
[🔒️rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
|
47
|
+
[🚎src-main]: https://github.com/pboling/debug_logging
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017-2023 Peter Boling (railsbling.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,31 +1,69 @@
|
|
1
1
|
# DebugLogging
|
2
2
|
|
3
|
+
<div id="badges">
|
4
|
+
|
5
|
+
[![CI Build][🚎dl-cwfi]][🚎dl-cwf]
|
6
|
+
[![Test Coverage][🔑cc-covi]][🔑cc-cov]
|
7
|
+
[![Maintainability][🔑cc-mnti]][🔑cc-mnt]
|
8
|
+
[![Depfu][🔑depfui]][🔑depfu]
|
9
|
+
|
10
|
+
-----
|
11
|
+
|
12
|
+
[![Liberapay Patrons][⛳liberapay-img]][⛳liberapay]
|
13
|
+
[![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor]
|
14
|
+
<span class="badge-buymeacoffee">
|
15
|
+
<a href="https://ko-fi.com/O5O86SNP4" target='_blank' title="Donate to my FLOSS or refugee efforts at ko-fi.com"><img src="https://img.shields.io/badge/buy%20me%20coffee-donate-yellow.svg" alt="Buy me coffee donation button" /></a>
|
16
|
+
</span>
|
17
|
+
<span class="badge-patreon">
|
18
|
+
<a href="https://patreon.com/galtzo" title="Donate to my FLOSS or refugee efforts using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a>
|
19
|
+
</span>
|
20
|
+
|
21
|
+
</div>
|
22
|
+
|
23
|
+
[⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
|
24
|
+
[⛳liberapay]: https://liberapay.com/pboling/donate
|
25
|
+
[🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
|
26
|
+
[🖇sponsor]: https://github.com/sponsors/pboling
|
27
|
+
|
28
|
+
|
3
29
|
Unobtrusive, inheritable-overridable-configurable, drop-in debug logging, that won't leave a mess behind when it is time to remove it.
|
4
30
|
Supports ActiveSupport::Notifications (thanks [@jgillson](https://github.com/jgillson)). Optional ActiveRecord callback-style hooks that you can decorate your methods with. Hooks logic was taken from the [`slippy_method_hooks` gem](https://github.com/guckin/slippy_method_hooks), (thanks [@guckin](https://github.com/guckin)), and prefaced with `debug_` for this implementation. `DebugLogging::Finalize` is lightly modified from [this stackoverflow answer](https://stackoverflow.com/a/34559282).
|
5
31
|
|
6
32
|
## What do I mean by "unobtrusive"?
|
7
33
|
|
8
|
-
**Ugly** debug logging is added inside the body of a method, so it runs when a method is called. This can create a mess of your git history, and can even introduce new bugs to your code.
|
34
|
+
**Ugly** debug logging is added inside the body of a method, so it runs when a method is called. This can create a mess of your git history, and can even introduce new bugs to your code. Don't `puts` all over your codebase... Instead use this gem.
|
9
35
|
|
10
36
|
**Unobtrusive** debug logging stays out of the method, changes no logic, can't break your code, and yet it still runs when your method is called, and tells you everything you wanted to know. It doesn't mess with the git history of the method at all!
|
11
37
|
|
12
|
-
| Project
|
13
|
-
|
14
|
-
|
|
15
|
-
| compatibility
|
16
|
-
| license
|
17
|
-
| download rank
|
18
|
-
| version
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
38
|
+
| Project | DebugLogging |
|
39
|
+
|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
40
|
+
| install | `bundle add debug_logging` |
|
41
|
+
| compatibility | Ruby >= 2.4 |
|
42
|
+
| license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
|
43
|
+
| download rank | [![Downloads Today](https://img.shields.io/gem/rd/debug_logging.svg)](https://github.com/pboling/debug_logging) |
|
44
|
+
| version | [![Version](https://img.shields.io/gem/v/debug_logging.svg)](https://rubygems.org/gems/debug_logging) |
|
45
|
+
| code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/debug_logging/badges/users.svg)](https://www.codetriage.com/pboling/debug_logging) |
|
46
|
+
| documentation | [on RDoc.info][documentation] |
|
47
|
+
| live chat | [![Join the chat at https://gitter.im/pboling/debug_logging](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pboling/debug_logging?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
|
48
|
+
| expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
|
49
|
+
| Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling), [👼](https://angel.co/peter-boling), [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay] [![Follow Me on LinkedIn][🖇linkedin-img]][🖇linkedin] [![Find Me on WellFound:][✌️wellfound-img]][✌️wellfound] [![My Blog][🚎blog-img]][🚎blog] [![Follow Me on Twitter][🐦twitter-img]][🐦twitter] |
|
50
|
+
|
51
|
+
[🚎dl-cwf]: https://github.com/pboling/debug_logging/actions/workflows/current.yml
|
52
|
+
[🚎dl-cwfi]: https://github.com/pboling/debug_logging/actions/workflows/current.yml/badge.svg
|
53
|
+
|
54
|
+
[⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
|
55
|
+
[⛳liberapay]: https://liberapay.com/pboling/donate
|
56
|
+
[🖇linkedin]: http://www.linkedin.com/in/peterboling
|
57
|
+
[🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-blue?style=plastic&logo=linkedin
|
58
|
+
[✌️wellfound]: https://angel.co/u/peter-boling
|
59
|
+
[✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=plastic&logo=angellist
|
60
|
+
[🐦twitter]: http://twitter.com/intent/user?screen_name=galtzo
|
61
|
+
[🐦twitter-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow%20@galtzo
|
62
|
+
[🚎blog]: http://www.railsbling.com/tags/oauth2/
|
63
|
+
[🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
|
64
|
+
[my🧪lab]: https://gitlab.com/pboling
|
65
|
+
[my🧊berg]: https://codeberg.org/pboling
|
66
|
+
[my🛖hut]: https://sr.ht/~galtzo/
|
29
67
|
|
30
68
|
### Gives you (all are optional):
|
31
69
|
|
@@ -54,11 +92,12 @@ Herein you will find:
|
|
54
92
|
* When the gem is loaded there are no monkey patches.
|
55
93
|
* Rather, your own classes/methods get "patched" and "hooked" as you configure them.
|
56
94
|
* 100% clean, 0% obtrusive
|
57
|
-
*
|
95
|
+
* Greater than 93% test coverage & 82% branch coverage
|
58
96
|
* 100% Ruby 2.1+ compatible
|
59
97
|
- use version `gem "debug_logging", "~> 1.0"` for Ruby < 2.3
|
60
98
|
- use version `gem "debug_logging", "~> 2.0"` for Ruby 2.3
|
61
|
-
- use version `gem "debug_logging", "~> 3.
|
99
|
+
- use version `gem "debug_logging", "~> 3.1"` for Ruby >= 2.4, < 3
|
100
|
+
- use version `gem "debug_logging", "~> 4.0"` (unreleased) for Ruby >= 3.
|
62
101
|
|
63
102
|
NOTE: The manner this is made to work for class methods is totally different than the way this is made to work for instance methods.
|
64
103
|
|
@@ -67,7 +106,7 @@ NOTE: The manner this is made to work for class methods is totally different tha
|
|
67
106
|
Add this line to your application's Gemfile:
|
68
107
|
|
69
108
|
```ruby
|
70
|
-
gem
|
109
|
+
gem "debug_logging", "~> 3.1"
|
71
110
|
```
|
72
111
|
|
73
112
|
And then execute:
|
@@ -82,6 +121,21 @@ Or install it yourself as:
|
|
82
121
|
|
83
122
|
Crack open the specs for more complex usage examples than the ones below.
|
84
123
|
|
124
|
+
### First, how do I turn it off when I need some silence?
|
125
|
+
|
126
|
+
For example, in your test suite, before you `require "config/environment"` or equivalent, do this:
|
127
|
+
|
128
|
+
```ruby
|
129
|
+
require "logger"
|
130
|
+
require "debug_logging"
|
131
|
+
|
132
|
+
logger = Logger.new($stdout)
|
133
|
+
logger.level = Logger::UNKNOWN # for silence!
|
134
|
+
DebugLogging.configuration.logger = logger
|
135
|
+
```
|
136
|
+
|
137
|
+
It will silence all of the places that have `extend DebugLogger`, _unless_ those places have overridden the logger config they inherited from the global config.
|
138
|
+
|
85
139
|
### Without Rails
|
86
140
|
|
87
141
|
It just works. ;)
|
@@ -98,7 +152,7 @@ DebugLogging.configuration.log_level = :debug # at what level do the messages cr
|
|
98
152
|
DebugLogging.configuration.multiple_last_hashes = false # pass every hash argument to last_hash_to_s_proc?
|
99
153
|
DebugLogging.configuration.last_hash_to_s_proc = nil # e.g. ->(hash) { "keys: #{hash.keys}" }
|
100
154
|
DebugLogging.configuration.last_hash_max_length = 1_000
|
101
|
-
DebugLogging.configuration.args_to_s_proc = nil # e.g. ->(record) { "record id: #{record.id}" }
|
155
|
+
DebugLogging.configuration.args_to_s_proc = nil # e.g. ->(*record) { "record id: #{record.first.id}" }
|
102
156
|
DebugLogging.configuration.args_max_length = 1_000
|
103
157
|
DebugLogging.configuration.instance_benchmarks = false
|
104
158
|
DebugLogging.configuration.class_benchmarks = false
|
@@ -106,11 +160,11 @@ DebugLogging.configuration.active_support_notifications = false
|
|
106
160
|
DebugLogging.configuration.colorized_chain_for_method = false # e.g. ->(colorized_string) { colorized_string.red.on_blue.underline }
|
107
161
|
DebugLogging.configuration.colorized_chain_for_class = false # e.g. ->(colorized_string) { colorized_string.colorize(:light_blue ).colorize( :background => :red) }
|
108
162
|
DebugLogging.configuration.add_invocation_id = true # identify a method call uniquely in a log, pass a proc for colorization, e.g. ->(colorized_string) { colorized_string.light_black }
|
109
|
-
DebugLogging.configuration.ellipsis =
|
163
|
+
DebugLogging.configuration.ellipsis = " ✂️ …".freeze
|
110
164
|
DebugLogging.configuration.mark_scope_exit = true # Only has an effect if benchmarking is off, since benchmarking always marks the scope exit
|
111
165
|
DebugLogging.configuration.add_payload = false # or a proc which will be called to print the payload
|
112
166
|
DebugLogging.configuration.payload_max_length = 1000
|
113
|
-
DebugLogging.configuration.error_handler_proc = nil # e.g. ->(error, config, obj) { config.log { "#{error.class}: #{error.message}\
|
167
|
+
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}" } }
|
114
168
|
```
|
115
169
|
|
116
170
|
If you prefer to use the block style:
|
@@ -122,7 +176,7 @@ DebugLogging.configure do |config|
|
|
122
176
|
config.multiple_last_hashes = false # pass every hash argument to last_hash_to_s_proc?
|
123
177
|
config.last_hash_to_s_proc = nil # e.g. ->(hash) { "keys: #{hash.keys}" }
|
124
178
|
config.last_hash_max_length = 1_000
|
125
|
-
config.args_to_s_proc = nil # e.g. ->(record) { "record id: #{record.id}" }
|
179
|
+
config.args_to_s_proc = nil # e.g. ->(*record) { "record id: #{record.first.id}" }
|
126
180
|
config.args_max_length = 1_000
|
127
181
|
config.instance_benchmarks = false
|
128
182
|
config.class_benchmarks = false
|
@@ -130,11 +184,11 @@ DebugLogging.configure do |config|
|
|
130
184
|
config.colorized_chain_for_method = false # e.g. ->(colorized_string) { colorized_string.red.on_blue.underline }
|
131
185
|
config.colorized_chain_for_class = false # e.g. ->(colorized_string) { colorized_string.colorize(:light_blue ).colorize( :background => :red) }
|
132
186
|
config.add_invocation_id = true # identify a method call uniquely in a log, pass a proc for colorization, e.g. ->(colorized_string) { colorized_string.light_black }
|
133
|
-
config.ellipsis =
|
187
|
+
config.ellipsis = " ✂️ …".freeze
|
134
188
|
config.mark_scope_exit = true # Only has an effect if benchmarking is off, since benchmarking always marks the scope exit
|
135
189
|
config.add_payload = false # or a proc which will be called to print the payload
|
136
190
|
config.payload_max_length = 1000
|
137
|
-
config.error_handler_proc = nil # e.g. ->(error, config, obj) { config.log { "#{error.class}: #{error.message}\
|
191
|
+
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}" } }
|
138
192
|
end
|
139
193
|
```
|
140
194
|
|
@@ -196,8 +250,8 @@ class Car
|
|
196
250
|
# In the last hash any non-Configuration keys will be data that gets logged,
|
197
251
|
# and also made available to last_hash_to_s_proc
|
198
252
|
logged :dealer_options, {
|
199
|
-
something:
|
200
|
-
multiple_last_hashes: true # <= Overrides config
|
253
|
+
something: "here", # <= will be logged, and available to last_hash_to_s_proc
|
254
|
+
multiple_last_hashes: true, # <= Overrides config
|
201
255
|
}
|
202
256
|
def self.will_not_be_logged
|
203
257
|
false
|
@@ -228,7 +282,7 @@ class Car
|
|
228
282
|
# Override configuration options for any instance method(s), by passing a hash as the last argument
|
229
283
|
# In the last hash any non-Configuration keys will be data that gets logged,
|
230
284
|
# and also made available to last_hash_to_s_proc
|
231
|
-
include DebugLogging::InstanceLogger.new(i_methods: [:faster], config: {
|
285
|
+
include DebugLogging::InstanceLogger.new(i_methods: [:faster], config: {add_invocation_id: false})
|
232
286
|
|
233
287
|
def will_not_be_logged
|
234
288
|
false
|
@@ -265,9 +319,11 @@ class Car
|
|
265
319
|
# For instance methods:
|
266
320
|
# Option 1: specify the exact method(s) to add instrumentation to
|
267
321
|
# NOTE: You can capture instance variable values as part of the event payload
|
268
|
-
include DebugLogging::InstanceNotifier.new(i_methods: [
|
269
|
-
|
270
|
-
|
322
|
+
include DebugLogging::InstanceNotifier.new(i_methods: [
|
323
|
+
:drive,
|
324
|
+
:stop,
|
325
|
+
[:turn, {instance_variables: %i[direction angle]}],
|
326
|
+
])
|
271
327
|
|
272
328
|
# For class methods
|
273
329
|
# Provides the versatile `notifies` method decorator / macro
|
@@ -299,8 +355,8 @@ class Car
|
|
299
355
|
# In the last hash any non-Configuration keys will be data that gets added to the event payload,
|
300
356
|
# and also made available to last_hash_to_s_proc
|
301
357
|
notifies :dealer_options, {
|
302
|
-
something:
|
303
|
-
add_invocation_id: false # <= Overrides config
|
358
|
+
something: "here", # <= will be added to the event payload, and be available to last_hash_to_s_proc
|
359
|
+
add_invocation_id: false, # <= Overrides config
|
304
360
|
}
|
305
361
|
def self.will_not_be_notified
|
306
362
|
false
|
@@ -327,7 +383,7 @@ class Car
|
|
327
383
|
# Override options for any instance method(s), by passing a hash as the last argument
|
328
384
|
# In the last hash any non-Configuration keys will be data that gets added to the event payload,
|
329
385
|
# and also made available to last_hash_to_s_proc
|
330
|
-
include DebugLogging::InstanceNotifier.new(i_methods: [:faster], config: {
|
386
|
+
include DebugLogging::InstanceNotifier.new(i_methods: [:faster], config: {add_invocation_id: false})
|
331
387
|
|
332
388
|
def will_not_be_notified
|
333
389
|
false
|
@@ -338,67 +394,70 @@ end
|
|
338
394
|
|
339
395
|
## Development
|
340
396
|
|
341
|
-
|
397
|
+
Run tests!
|
342
398
|
|
343
|
-
|
399
|
+
```shell
|
400
|
+
bundle install
|
401
|
+
bundle exec rake
|
402
|
+
```
|
344
403
|
|
345
404
|
## Contributing
|
346
405
|
|
347
|
-
|
406
|
+
See [CONTRIBUTING.md][🪇conduct]
|
407
|
+
|
408
|
+
[🪇conduct]: CONTRIBUTING.md
|
409
|
+
|
410
|
+
## 🪇 Code of Conduct
|
411
|
+
|
412
|
+
Everyone interacting in this project's codebases, issue trackers,
|
413
|
+
chat rooms and mailing lists is expected to follow the [code of conduct][🪇conduct].
|
348
414
|
|
349
|
-
|
350
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
351
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
352
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
353
|
-
5. Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
354
|
-
6. Create new Pull Request
|
415
|
+
[🪇conduct]: CODE_OF_CONDUCT.md
|
355
416
|
|
356
|
-
## Versioning
|
417
|
+
## 📌 Versioning
|
357
418
|
|
358
|
-
This
|
359
|
-
Violations of this scheme should be reported as bugs.
|
360
|
-
if a minor or patch version is released that breaks backward
|
361
|
-
|
362
|
-
|
363
|
-
only be introduced with new major versions.
|
419
|
+
This Library adheres to [Semantic Versioning 2.0.0][📌semver].
|
420
|
+
Violations of this scheme should be reported as bugs.
|
421
|
+
Specifically, if a minor or patch version is released that breaks backward compatibility,
|
422
|
+
a new version should be immediately released that restores compatibility.
|
423
|
+
Breaking changes to the public API will only be introduced with new major versions.
|
364
424
|
|
365
|
-
|
366
|
-
|
425
|
+
To get a better understanding of how SemVer is intended to work over a project's lifetime,
|
426
|
+
read this article from the creator of SemVer:
|
427
|
+
|
428
|
+
- ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
|
429
|
+
|
430
|
+
As a result of this policy, you can (and should) specify a dependency on these libraries using
|
431
|
+
the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
|
367
432
|
|
368
433
|
For example:
|
369
434
|
|
370
435
|
```ruby
|
371
|
-
spec.add_dependency
|
436
|
+
spec.add_dependency("debug_logging", "~> 3.1")
|
372
437
|
```
|
373
438
|
|
374
|
-
|
439
|
+
[comment]: <> ( VERSIONING LINKS )
|
375
440
|
|
376
|
-
|
441
|
+
[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
442
|
+
[📌semver]: http://semver.org/
|
443
|
+
[📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
|
377
444
|
|
378
|
-
|
445
|
+
## 📄 License
|
379
446
|
|
380
|
-
|
381
|
-
|
382
|
-
"Software"), to deal in the Software without restriction, including
|
383
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
384
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
385
|
-
permit persons to whom the Software is furnished to do so, subject to
|
386
|
-
the following conditions:
|
447
|
+
The gem is available as open source under the terms of
|
448
|
+
the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref], with one exception:
|
387
449
|
|
388
|
-
|
389
|
-
|
450
|
+
* [`lib/debug_logging/finalize.rb`](lib/debug_logging/finalize.rb) came from [this StackOverflow](https://stackoverflow.com/a/34559282).
|
451
|
+
* As such, it is licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
|
390
452
|
|
391
|
-
|
392
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
393
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
394
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
395
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
396
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
397
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
453
|
+
See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
|
398
454
|
|
399
|
-
|
455
|
+
[comment]: <> ( LEGAL LINKS )
|
400
456
|
|
401
|
-
|
457
|
+
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
458
|
+
[📄license]: LICENSE.txt
|
459
|
+
[📄license-ref]: https://opensource.org/licenses/MIT
|
460
|
+
[📄license-img]: https://img.shields.io/badge/License-MIT-green.svg
|
402
461
|
|
403
462
|
[semver]: http://semver.org/
|
404
463
|
[pvc]: http://docs.rubygems.org/read/chapter/16#page74
|
@@ -409,3 +468,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
409
468
|
[documentation]: http://rdoc.info/github/pboling/debug_logging/frames
|
410
469
|
[homepage]: https://github.com/pboling/debug_logging
|
411
470
|
[blogpage]: http://www.railsbling.com/tags/debug_logging/
|
471
|
+
|
472
|
+
[comment]: <> ( PERSONAL LINKS )
|
473
|
+
|
474
|
+
[💁🏼♂️aboutme]: https://about.me/peter.boling
|
475
|
+
[💁🏼♂️angellist]: https://angel.co/peter-boling
|
476
|
+
[💁🏼♂️devto]: https://dev.to/galtzo
|
477
|
+
[💁🏼♂️followme]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
|
478
|
+
[💁🏼♂️twitter]: http://twitter.com/galtzo
|
479
|
+
|
480
|
+
[comment]: <> ( KEYED LINKS )
|
481
|
+
|
482
|
+
[🔑cc-mnt]: https://codeclimate.com/github/pboling/debug_logging/maintainability
|
483
|
+
[🔑cc-mnti]: https://api.codeclimate.com/v1/badges/1f36d7019c3b81cae1a2/maintainability
|
484
|
+
[🔑cc-cov]: https://codeclimate.com/github/pboling/debug_logging/test_coverage
|
485
|
+
[🔑cc-covi]: https://api.codeclimate.com/v1/badges/1f36d7019c3b81cae1a2/test_coverage
|
486
|
+
[🔑depfu]: https://depfu.com/github/pboling/debug_logging?project_id=2675
|
487
|
+
[🔑depfui]: https://badges.depfu.com/badges/d1a4cf43255916521fef1e3685c61faa/count.svg
|
data/SECURITY.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
## Supported Versions
|
4
|
+
|
5
|
+
| Version | Supported |
|
6
|
+
|---------|-----------|
|
7
|
+
| 3.1.x | ✅ |
|
8
|
+
| 3.0.x | ❌ |
|
9
|
+
| 2.x | ❌ |
|
10
|
+
| 1.x | ❌ |
|
11
|
+
|
12
|
+
## Reporting a Vulnerability
|
13
|
+
|
14
|
+
Peter Boling is the primary maintainer of this gem. Please find a way
|
15
|
+
to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
|
16
|
+
possible.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "debug_logging/log_subscriber"
|
4
|
+
require "debug_logging/class_notifier"
|
5
|
+
require "debug_logging/instance_notifier_modulizer"
|
6
|
+
require "debug_logging/instance_notifier"
|