debug_logging 3.1.8 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,31 +1,70 @@
1
1
  # DebugLogging
2
2
 
3
- Unobtrusive, inheritable-overridable-configurable, drop-in debug logging, that won't leave a mess behind when it is time to remove it.
4
- 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).
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
+
29
+ Unobtrusive, inheritable-overridable-configurable, drop-in debug logging, instrumented via method decorators.
30
+ Don't leave a mess behind when it is time to remove logging!
31
+ 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
32
 
6
33
  ## What do I mean by "unobtrusive"?
7
34
 
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.
35
+ **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
36
 
10
37
  **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
38
 
12
- | Project | DebugLogging |
13
- |------------------------ | ----------------------- |
14
- | gem name | [debug_logging](https://rubygems.org/gems/debug_logging) |
15
- | compatibility | Ruby 2.4, 2.5, 2.6, 2.7 |
16
- | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
17
- | download rank | [![Downloads Today](https://img.shields.io/gem/rd/debug_logging.svg)](https://github.com/pboling/debug_logging) |
18
- | version | [![Version](https://img.shields.io/gem/v/debug_logging.svg)](https://rubygems.org/gems/debug_logging) |
19
- | dependencies | [![Depfu](https://badges.depfu.com/badges/d1a4cf43255916521fef1e3685c61faa/count.svg)](https://depfu.com/github/pboling/debug_logging?project_id=2675) |
20
- | continuous integration | [![Build Status](https://travis-ci.org/pboling/debug_logging.svg?branch=master)](https://travis-ci.org/pboling/debug_logging) |
21
- | test coverage | [![Test Coverage](https://api.codeclimate.com/v1/badges/1f36d7019c3b81cae1a2/test_coverage)](https://codeclimate.com/github/pboling/debug_logging/test_coverage) |
22
- | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/1f36d7019c3b81cae1a2/maintainability)](https://codeclimate.com/github/pboling/debug_logging/maintainability) |
23
- | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/debug_logging/badges/users.svg)](https://www.codetriage.com/pboling/debug_logging) |
24
- | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
25
- | documentation | [on RDoc.info][documentation] |
26
- | 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) |
27
- | 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) |
28
- | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling), [👼](https://angel.co/peter-boling), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo), [🌹](https://nationalprogressiveparty.org) |
39
+ | Project | DebugLogging |
40
+ |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
41
+ | install | `bundle add debug_logging` |
42
+ | compatibility | Ruby >= 3.1 (use version 3.x for Ruby 2.4 - 2.7 compatibility) |
43
+ | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
44
+ | download rank | [![Downloads Today](https://img.shields.io/gem/rd/debug_logging.svg)](https://github.com/pboling/debug_logging) |
45
+ | version | [![Version](https://img.shields.io/gem/v/debug_logging.svg)](https://rubygems.org/gems/debug_logging) |
46
+ | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/debug_logging/badges/users.svg)](https://www.codetriage.com/pboling/debug_logging) |
47
+ | documentation | [on RDoc.info][documentation] |
48
+ | 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) |
49
+ | 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) |
50
+ | 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] |
51
+
52
+ [🚎dl-cwf]: https://github.com/pboling/debug_logging/actions/workflows/current.yml
53
+ [🚎dl-cwfi]: https://github.com/pboling/debug_logging/actions/workflows/current.yml/badge.svg
54
+
55
+ [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
56
+ [⛳liberapay]: https://liberapay.com/pboling/donate
57
+ [🖇linkedin]: http://www.linkedin.com/in/peterboling
58
+ [🖇linkedin-img]: https://img.shields.io/badge/PeterBoling-blue?style=plastic&logo=linkedin
59
+ [✌️wellfound]: https://angel.co/u/peter-boling
60
+ [✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=plastic&logo=angellist
61
+ [🐦twitter]: http://twitter.com/intent/user?screen_name=galtzo
62
+ [🐦twitter-img]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow%20@galtzo
63
+ [🚎blog]: http://www.railsbling.com/tags/oauth2/
64
+ [🚎blog-img]: https://img.shields.io/badge/blog-railsbling-brightgreen.svg?style=flat
65
+ [my🧪lab]: https://gitlab.com/pboling
66
+ [my🧊berg]: https://codeberg.org/pboling
67
+ [my🛖hut]: https://sr.ht/~galtzo/
29
68
 
30
69
  ### Gives you (all are optional):
31
70
 
@@ -49,25 +88,25 @@ Supports ActiveSupport::Notifications (thanks [@jgillson](https://github.com/jgi
49
88
 
50
89
  Herein you will find:
51
90
 
52
- * Classes inheriting from Module
91
+ * ~~Classes inheriting from Module~~ Refactored to use standard Modules and `prepend`!
53
92
  * Zero tolerance policy on monkey patching
54
93
  * When the gem is loaded there are no monkey patches.
55
94
  * Rather, your own classes/methods get "patched" and "hooked" as you configure them.
56
95
  * 100% clean, 0% obtrusive
57
- * ~100% tested
96
+ * Greater than 94% test coverage & 82% branch coverage
58
97
  * 100% Ruby 2.1+ compatible
59
98
  - use version `gem "debug_logging", "~> 1.0"` for Ruby < 2.3
60
99
  - use version `gem "debug_logging", "~> 2.0"` for Ruby 2.3
61
- - use version `gem "debug_logging", "~> 3.0"` for Ruby 2.4+
62
-
63
- 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.
100
+ - use version `gem "debug_logging", "~> 3.1"` for Ruby >= 2.4, < 3
101
+ - apologies to Ruby 3.0, which is hiding under a blanket
102
+ - use version `gem "debug_logging", "~> 4.0"` for Ruby >= 3.1
64
103
 
65
104
  ## Installation
66
105
 
67
106
  Add this line to your application's Gemfile:
68
107
 
69
108
  ```ruby
70
- gem 'debug_logging'
109
+ gem "debug_logging", "~> 4.0"
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,7 +160,7 @@ 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 = ' ✂️ …'.freeze
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
@@ -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,7 +184,7 @@ 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 = ' ✂️ …'.freeze
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
@@ -145,7 +199,14 @@ Just prepend `debug_` to any config value you want to override in a class.
145
199
  Just prepend `debug_` to any config value you want to override on an instance of a class.
146
200
 
147
201
  **All** of the above **config** is **inheritable** and **configurable** at the **per-method** level as well!
148
- Just send along a hash of the config options when you call `logged` or `include DebugLogging::InstanceLogger.new(i_methods: [:drive, :stop], config: { ellipsis: " ✂️ 2 much" })`. See the example class below, and the specs.
202
+ Just send along a hash of the config options, similar to the following:
203
+
204
+ - `logged :drive, { ellipsis: " ✂️ it out" }`
205
+ - `i_logged [:drive, :stop], { ellipsis: " ✂️ 2 much" }`
206
+ - `notified :drive, { ellipsis: " ✂️ it out" }`
207
+ - `i_notified [:drive, :stop], { ellipsis: " ✂️ 2 much" }`
208
+
209
+ See the example class below, and the specs.
149
210
 
150
211
  **NOTE ON** `Rails.logger` - It will probably be nil in your initializer, so setting the `config.logger` to `Rails.logger` there will result in setting it to `nil`, which means the default will end up being used: `Logger.new(STDOUT)`. Instead just config the logger in your application.rb, or anytime later, but *before your classes get loaded* and start inheriting the config:
151
212
 
@@ -168,9 +229,10 @@ class Car
168
229
 
169
230
  # For class methods
170
231
  # Provides the versatile `logged` method decorator / macro
232
+ extend DebugLogging::ClassLogger
171
233
  # For instance methods
172
234
  # Provides the versatile `i_logged` method decorator / macro
173
- extend DebugLogging::ClassLogger
235
+ extend DebugLogging::InstanceLogger
174
236
 
175
237
  # == BEGIN CLASS METHODS ==
176
238
  # For class methods:
@@ -196,8 +258,8 @@ class Car
196
258
  # In the last hash any non-Configuration keys will be data that gets logged,
197
259
  # and also made available to last_hash_to_s_proc
198
260
  logged :dealer_options, {
199
- something: 'here', # <= will be logged, and available to last_hash_to_s_proc
200
- multiple_last_hashes: true # <= Overrides config
261
+ something: "here", # <= will be logged, and available to last_hash_to_s_proc
262
+ multiple_last_hashes: true, # <= Overrides config
201
263
  }
202
264
  def self.will_not_be_logged
203
265
  false
@@ -206,8 +268,12 @@ class Car
206
268
 
207
269
  # == BEGIN INSTANCE METHODS ==
208
270
  # For instance methods:
209
- # Option 1: specify the exact method(s) to add logging to
210
- include DebugLogging::InstanceLogger.new(i_methods: %i[drive stop])
271
+ # Option 1: specify the exact method(s) to add logging to, and optionally customize
272
+ i_notified [
273
+ :drive,
274
+ :stop,
275
+ [:turn, {instance_variables: %i[direction angle]}],
276
+ ]
211
277
 
212
278
  def drive(speed)
213
279
  speed
@@ -219,16 +285,21 @@ class Car
219
285
 
220
286
  # For instance methods:
221
287
  # Option 2: add logging to all instance methods defined above (but *not* defined below)
222
- include DebugLogging::InstanceLogger.new(i_methods: instance_methods(false))
288
+ i_logged instance_methods(false)
223
289
 
224
290
  def faster(**_opts)
225
- 0
291
+ 5
226
292
  end
227
293
 
228
294
  # Override configuration options for any instance method(s), by passing a hash as the last argument
229
295
  # In the last hash any non-Configuration keys will be data that gets logged,
230
296
  # and also made available to last_hash_to_s_proc
231
- include DebugLogging::InstanceLogger.new(i_methods: [:faster], config: { add_invocation_id: false })
297
+ i_logged [:faster], {add_invocation_id: false}
298
+
299
+ # You can also use `i_logged` as a true method decorator:
300
+ i_logged def slower
301
+ 2
302
+ end
232
303
 
233
304
  def will_not_be_logged
234
305
  false
@@ -259,26 +330,28 @@ Every time a method is called, class and instance method events are instrumented
259
330
  class Car
260
331
  # Adds the helper methods to the class.
261
332
  # All helpers prefixed with debug_*,
262
- # except for the *notifies* decorator, which comes from extending DebugLogging::ClassNotifier
333
+ # except for the *notified* decorator, which comes from extending DebugLogging::ClassNotifier
263
334
  extend DebugLogging
335
+ # For instance methods
336
+ # Provides the versatile `i_notified` method decorator / macro
337
+ extend DebugLogging::InstanceNotifier
338
+ # For class methods
339
+ # Provides the versatile `notified` method decorator / macro
340
+ extend DebugLogging::ClassNotifier
264
341
 
265
342
  # For instance methods:
266
343
  # Option 1: specify the exact method(s) to add instrumentation to
267
344
  # NOTE: You can capture instance variable values as part of the event payload
268
- include DebugLogging::InstanceNotifier.new(i_methods: [:drive,
269
- :stop,
270
- [:turn, { instance_variables: %i[direction angle] }]])
271
-
272
- # For class methods
273
- # Provides the versatile `notifies` method decorator / macro
274
- # For instance methods
275
- # Provides the versatile `i_notifies` method decorator / macro
276
- extend DebugLogging::ClassNotifier
345
+ i_notified [
346
+ :drive,
347
+ :stop,
348
+ [:turn, {instance_variables: %i[direction angle]}],
349
+ ]
277
350
 
278
351
  # == BEGIN CLASS METHODS ==
279
352
  # For class methods:
280
- # Option 1: Use *notifies* as a method decorator
281
- notifies def self.make
353
+ # Option 1: Use *notified* as a method decorator
354
+ notified def self.make
282
355
  new
283
356
  end
284
357
  def self.design(*_args)
@@ -294,13 +367,13 @@ class Car
294
367
  end
295
368
 
296
369
  # Option 2: Use *logged* as a macro
297
- notifies :design, :safety
370
+ notified :design, :safety
298
371
  # Override configuration options for any class method(s), by passing a hash as the last argument
299
372
  # In the last hash any non-Configuration keys will be data that gets added to the event payload,
300
373
  # and also made available to last_hash_to_s_proc
301
- notifies :dealer_options, {
302
- something: 'here', # <= will be added to the event payload, and be available to last_hash_to_s_proc
303
- add_invocation_id: false # <= Overrides config
374
+ notified :dealer_options, {
375
+ something: "here", # <== will be added to the event payload, and be available to last_hash_to_s_proc
376
+ add_invocation_id: false, # <== Overrides config
304
377
  }
305
378
  def self.will_not_be_notified
306
379
  false
@@ -317,8 +390,8 @@ class Car
317
390
  end
318
391
 
319
392
  # For instance methods:
320
- # Option 2: add instrumentation to all instance methods defined above (but *not* defined below)
321
- include DebugLogging::InstanceNotifier.new(i_methods: instance_methods(false))
393
+ # Option 2: add notification instrumentation to all instance methods defined above (but *not* defined below)
394
+ i_notified instance_methods(false)
322
395
 
323
396
  def faster(**_opts)
324
397
  0
@@ -327,7 +400,7 @@ class Car
327
400
  # Override options for any instance method(s), by passing a hash as the last argument
328
401
  # In the last hash any non-Configuration keys will be data that gets added to the event payload,
329
402
  # and also made available to last_hash_to_s_proc
330
- include DebugLogging::InstanceNotifier.new(i_methods: [:faster], config: { add_invocation_id: false })
403
+ i_notified [:faster], {add_invocation_id: false}
331
404
 
332
405
  def will_not_be_notified
333
406
  false
@@ -338,67 +411,70 @@ end
338
411
 
339
412
  ## Development
340
413
 
341
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
414
+ Run tests!
342
415
 
343
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
416
+ ```shell
417
+ bundle install
418
+ bundle exec rake
419
+ ```
344
420
 
345
421
  ## Contributing
346
422
 
347
- Bug reports and pull requests are welcome on GitHub at https://github.com/pboling/debug_logging.
423
+ See [CONTRIBUTING.md][🪇conduct]
348
424
 
349
- 1. Fork it
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
425
+ [🪇conduct]: CONTRIBUTING.md
355
426
 
356
- ## Versioning
427
+ ## 🪇 Code of Conduct
357
428
 
358
- This library aims to adhere to [Semantic Versioning 2.0.0](http://semver.org/).
359
- Violations of this scheme should be reported as bugs. Specifically,
360
- if a minor or patch version is released that breaks backward
361
- compatibility, a new version should be immediately released that
362
- restores compatibility. Breaking changes to the public API will
363
- only be introduced with new major versions.
429
+ Everyone interacting in this project's codebases, issue trackers,
430
+ chat rooms and mailing lists is expected to follow the [code of conduct][🪇conduct].
364
431
 
365
- As a result of this policy, you can (and should) specify a
366
- dependency on this gem using the [Pessimistic Version Constraint](http://docs.rubygems.org/read/chapter/16#page74) with two digits of precision.
432
+ [🪇conduct]: CODE_OF_CONDUCT.md
433
+
434
+ ## 📌 Versioning
435
+
436
+ This Library adheres to [Semantic Versioning 2.0.0][📌semver].
437
+ Violations of this scheme should be reported as bugs.
438
+ Specifically, if a minor or patch version is released that breaks backward compatibility,
439
+ a new version should be immediately released that restores compatibility.
440
+ Breaking changes to the public API will only be introduced with new major versions.
441
+
442
+ To get a better understanding of how SemVer is intended to work over a project's lifetime,
443
+ read this article from the creator of SemVer:
444
+
445
+ - ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
446
+
447
+ As a result of this policy, you can (and should) specify a dependency on these libraries using
448
+ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
367
449
 
368
450
  For example:
369
451
 
370
452
  ```ruby
371
- spec.add_dependency 'debug_logging', '~> 3.1'
453
+ spec.add_dependency("debug_logging", "~> 4.0")
372
454
  ```
373
455
 
374
- ## License [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
456
+ [comment]: <> ( VERSIONING LINKS )
375
457
 
376
- MIT License
458
+ [📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
459
+ [📌semver]: http://semver.org/
460
+ [📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
377
461
 
378
- Copyright (c) 2017 - 2020 [Peter Boling][peterboling] of [RailsBling.com][railsbling]
462
+ ## 📄 License
379
463
 
380
- Permission is hereby granted, free of charge, to any person obtaining
381
- a copy of this software and associated documentation files (the
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:
464
+ The gem is available as open source under the terms of
465
+ the [MIT License][📄license] [![License: MIT][📄license-img]][📄license-ref], with one exception:
387
466
 
388
- The above copyright notice and this permission notice shall be
389
- included in all copies or substantial portions of the Software.
467
+ * [`lib/debug_logging/finalize.rb`](lib/debug_logging/finalize.rb) came from [this StackOverflow](https://stackoverflow.com/a/34559282).
468
+ * As such, it is licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/)
390
469
 
391
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
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.
470
+ See [LICENSE.txt][📄license] for the official [Copyright Notice][📄copyright-notice-explainer].
398
471
 
399
- ### License Exceptions
472
+ [comment]: <> ( LEGAL LINKS )
400
473
 
401
- * [`debug_logging/finalize`](https://stackoverflow.com/a/34559282) is licensed under https://creativecommons.org/licenses/by-sa/4.0/
474
+ [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
475
+ [📄license]: LICENSE.txt
476
+ [📄license-ref]: https://opensource.org/licenses/MIT
477
+ [📄license-img]: https://img.shields.io/badge/License-MIT-green.svg
402
478
 
403
479
  [semver]: http://semver.org/
404
480
  [pvc]: http://docs.rubygems.org/read/chapter/16#page74
@@ -409,3 +485,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
409
485
  [documentation]: http://rdoc.info/github/pboling/debug_logging/frames
410
486
  [homepage]: https://github.com/pboling/debug_logging
411
487
  [blogpage]: http://www.railsbling.com/tags/debug_logging/
488
+
489
+ [comment]: <> ( PERSONAL LINKS )
490
+
491
+ [💁🏼‍♂️aboutme]: https://about.me/peter.boling
492
+ [💁🏼‍♂️angellist]: https://angel.co/peter-boling
493
+ [💁🏼‍♂️devto]: https://dev.to/galtzo
494
+ [💁🏼‍♂️followme]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
495
+ [💁🏼‍♂️twitter]: http://twitter.com/galtzo
496
+
497
+ [comment]: <> ( KEYED LINKS )
498
+
499
+ [🔑cc-mnt]: https://codeclimate.com/github/pboling/debug_logging/maintainability
500
+ [🔑cc-mnti]: https://api.codeclimate.com/v1/badges/1f36d7019c3b81cae1a2/maintainability
501
+ [🔑cc-cov]: https://codeclimate.com/github/pboling/debug_logging/test_coverage
502
+ [🔑cc-covi]: https://api.codeclimate.com/v1/badges/1f36d7019c3b81cae1a2/test_coverage
503
+ [🔑depfu]: https://depfu.com/github/pboling/debug_logging?project_id=2675
504
+ [🔑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,4 @@
1
- # frozen_string_literal: true
2
-
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'
1
+ require "debug_logging/log_subscriber"
2
+ require "debug_logging/class_notifier"
3
+ require "debug_logging/instance_notifier_modulizer"
4
+ require "debug_logging/instance_notifier"