debug_logging 1.0.17 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d234b40fc99de752fa25984cfd20bad70087a1147fccefaddf9e7b082fb9d1c7
4
- data.tar.gz: 291e57e9e9f9794da89ddf220744df3e1440902a86616aac10dc65779824ae73
3
+ metadata.gz: 6783c4fff86c30c678b2fd856a513d3400625f7068d1735035ebd33ee42ebbc8
4
+ data.tar.gz: 86b3b4fe6d8e7476049772c250a51c5b5a9dc20f0b6988490de780ac0b24627a
5
5
  SHA512:
6
- metadata.gz: 3ed53e0d9b4d1205c66f0ec62ffe121c06f995db9f377c73da642dba8d68cade983fab6df802f20506959e28075874049c6ffd16882ee4589e1f1896a170a35c
7
- data.tar.gz: 74ff60f6e26a107a57c209e62205f3b2d5d8ecc36cd591d383f41bec46a2ced3c690389a920eb708e1654b0da44b78946558ef7820b47bfba51d8ee94d1fde61
6
+ metadata.gz: bb65b3efd7beec972f818afd528e45c810dd7da0b5762a9f7f990d15d96093b9d81e7da2fa0f2dd7e7d2a925686324d1031e0b722c306593a06c6671be1c2e77
7
+ data.tar.gz: d05fad773afdfa701218f101cc97db708b726c55bda17ccd4784fbeb85d3ade6309dfe95a779afd825582c7d09883c17a2f5d4eb0d78837debde759419eae16d
@@ -0,0 +1,99 @@
1
+ AllCops:
2
+ NewCops: enable
3
+
4
+ Layout/BeginEndAlignment: # (new in 0.91)
5
+ Enabled: true
6
+ Layout/EmptyLinesAroundAttributeAccessor: # (new in 0.83)
7
+ Enabled: true
8
+ Layout/SpaceAroundMethodCallOperator: # (new in 0.82)
9
+ Enabled: true
10
+ Lint/BinaryOperatorWithIdenticalOperands: # (new in 0.89)
11
+ Enabled: true
12
+ Lint/ConstantDefinitionInBlock: # (new in 0.91)
13
+ Enabled: true
14
+ Lint/DeprecatedOpenSSLConstant: # (new in 0.84)
15
+ Enabled: true
16
+ Lint/DuplicateElsifCondition: # (new in 0.88)
17
+ Enabled: true
18
+ Lint/DuplicateRequire: # (new in 0.90)
19
+ Enabled: true
20
+ Lint/DuplicateRescueException: # (new in 0.89)
21
+ Enabled: true
22
+ Lint/EmptyConditionalBody: # (new in 0.89)
23
+ Enabled: true
24
+ Lint/EmptyFile: # (new in 0.90)
25
+ Enabled: true
26
+ Lint/FloatComparison: # (new in 0.89)
27
+ Enabled: true
28
+ Lint/IdentityComparison: # (new in 0.91)
29
+ Enabled: true
30
+ Lint/MissingSuper: # (new in 0.89)
31
+ Enabled: true
32
+ Lint/MixedRegexpCaptureTypes: # (new in 0.85)
33
+ Enabled: true
34
+ Lint/OutOfRangeRegexpRef: # (new in 0.89)
35
+ Enabled: true
36
+ Lint/RaiseException: # (new in 0.81)
37
+ Enabled: true
38
+ Lint/SelfAssignment: # (new in 0.89)
39
+ Enabled: true
40
+ Lint/StructNewOverride: # (new in 0.81)
41
+ Enabled: true
42
+ Lint/TopLevelReturnWithArgument: # (new in 0.89)
43
+ Enabled: true
44
+ Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
45
+ Enabled: true
46
+ Lint/UnreachableLoop: # (new in 0.89)
47
+ Enabled: true
48
+ Lint/UselessMethodDefinition: # (new in 0.90)
49
+ Enabled: true
50
+ Lint/UselessTimes: # (new in 0.91)
51
+ Enabled: true
52
+ Style/AccessorGrouping: # (new in 0.87)
53
+ Enabled: true
54
+ Style/BisectedAttrAccessor: # (new in 0.87)
55
+ Enabled: true
56
+ Style/CaseLikeIf: # (new in 0.88)
57
+ Enabled: true
58
+ Style/CombinableLoops: # (new in 0.90)
59
+ Enabled: true
60
+ Style/ExplicitBlockArgument: # (new in 0.89)
61
+ Enabled: true
62
+ Style/ExponentialNotation: # (new in 0.82)
63
+ Enabled: true
64
+ Style/GlobalStdStream: # (new in 0.89)
65
+ Enabled: true
66
+ Style/HashAsLastArrayItem: # (new in 0.88)
67
+ Enabled: true
68
+ Style/HashEachMethods: # (new in 0.80)
69
+ Enabled: true
70
+ Style/HashLikeCase: # (new in 0.88)
71
+ Enabled: true
72
+ Style/HashTransformKeys: # (new in 0.80)
73
+ Enabled: true
74
+ Style/HashTransformValues: # (new in 0.80)
75
+ Enabled: true
76
+ Style/KeywordParametersOrder: # (new in 0.90)
77
+ Enabled: true
78
+ Style/OptionalBooleanParameter: # (new in 0.89)
79
+ Enabled: true
80
+ Style/RedundantAssignment: # (new in 0.87)
81
+ Enabled: true
82
+ Style/RedundantFetchBlock: # (new in 0.86)
83
+ Enabled: true
84
+ Style/RedundantFileExtensionInRequire: # (new in 0.88)
85
+ Enabled: true
86
+ Style/RedundantRegexpCharacterClass: # (new in 0.85)
87
+ Enabled: true
88
+ Style/RedundantRegexpEscape: # (new in 0.85)
89
+ Enabled: true
90
+ Style/RedundantSelfAssignment: # (new in 0.90)
91
+ Enabled: true
92
+ Style/SingleArgumentDig: # (new in 0.89)
93
+ Enabled: true
94
+ Style/SlicingWithRange: # (new in 0.83)
95
+ Enabled: true
96
+ Style/SoleNestedConditional: # (new in 0.89)
97
+ Enabled: true
98
+ Style/StringConcatenation: # (new in 0.89)
99
+ Enabled: true
@@ -0,0 +1,126 @@
1
+ inherit_from: .rubocop.yml
2
+
3
+ # This configuration was generated by
4
+ # `rubocop --auto-gen-config`
5
+ # on 2020-10-06 07:34:51 UTC using RuboCop version 0.92.0.
6
+ # The point is for the user to remove these configuration records
7
+ # one by one as the offenses are removed from the code base.
8
+ # Note that changes in the inspected code, or installation of new
9
+ # versions of RuboCop, may require this file to be generated again.
10
+
11
+ # Offense count: 1
12
+ # Configuration parameters: Include.
13
+ # Include: **/*.gemspec
14
+ Gemspec/RequiredRubyVersion:
15
+ Exclude:
16
+ - 'debug_logging.gemspec'
17
+
18
+ # Offense count: 1
19
+ # Cop supports --auto-correct.
20
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
21
+ # SupportedStyles: space, no_space
22
+ # SupportedStylesForEmptyBraces: space, no_space
23
+ Layout/SpaceInsideBlockBraces:
24
+ Exclude:
25
+ - 'lib/debug_logging/argument_printer.rb'
26
+
27
+ # Offense count: 5
28
+ # Configuration parameters: IgnoredMethods.
29
+ Metrics/AbcSize:
30
+ Max: 97
31
+
32
+ # Offense count: 38
33
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
34
+ # ExcludedMethods: refine
35
+ Metrics/BlockLength:
36
+ Max: 756
37
+
38
+ # Offense count: 6
39
+ # Configuration parameters: CountBlocks.
40
+ Metrics/BlockNesting:
41
+ Max: 4
42
+
43
+ # Offense count: 1
44
+ # Configuration parameters: CountComments, CountAsOne.
45
+ Metrics/ClassLength:
46
+ Max: 101
47
+
48
+ # Offense count: 4
49
+ # Configuration parameters: IgnoredMethods.
50
+ Metrics/CyclomaticComplexity:
51
+ Max: 22
52
+
53
+ # Offense count: 11
54
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
55
+ Metrics/MethodLength:
56
+ Max: 50
57
+
58
+ # Offense count: 1
59
+ # Configuration parameters: CountComments, CountAsOne.
60
+ Metrics/ModuleLength:
61
+ Max: 112
62
+
63
+ # Offense count: 4
64
+ # Configuration parameters: IgnoredMethods.
65
+ Metrics/PerceivedComplexity:
66
+ Max: 26
67
+
68
+ # Offense count: 1
69
+ # Configuration parameters: AllowedChars.
70
+ Style/AsciiComments:
71
+ Exclude:
72
+ - 'lib/debug_logging/configuration.rb'
73
+
74
+ # Offense count: 1
75
+ # Cop supports --auto-correct.
76
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
77
+ # SupportedStyles: assign_to_condition, assign_inside_condition
78
+ Style/ConditionalAssignment:
79
+ Exclude:
80
+ - 'lib/debug_logging/argument_printer.rb'
81
+
82
+ # Offense count: 9
83
+ Style/Documentation:
84
+ Exclude:
85
+ - 'spec/**/*'
86
+ - 'test/**/*'
87
+ - 'lib/debug_logging.rb'
88
+ - 'lib/debug_logging/argument_printer.rb'
89
+ - 'lib/debug_logging/class_logger.rb'
90
+ - 'lib/debug_logging/configuration.rb'
91
+ - 'lib/debug_logging/instance_logger.rb'
92
+ - 'lib/debug_logging/instance_logger_modulizer.rb'
93
+ - 'lib/simple_debug_logging.rb'
94
+
95
+ # Offense count: 1
96
+ # Cop supports --auto-correct.
97
+ # Configuration parameters: EnforcedStyle.
98
+ # SupportedStyles: empty, nil, both
99
+ Style/EmptyElse:
100
+ Exclude:
101
+ - 'lib/debug_logging/class_logger.rb'
102
+
103
+ # Offense count: 2
104
+ # Configuration parameters: EnforcedStyle.
105
+ # SupportedStyles: annotated, template, unannotated
106
+ Style/FormatStringToken:
107
+ Exclude:
108
+ - 'lib/debug_logging/argument_printer.rb'
109
+
110
+ # Offense count: 4
111
+ Style/IdenticalConditionalBranches:
112
+ Exclude:
113
+ - 'lib/debug_logging/class_logger.rb'
114
+ - 'lib/debug_logging/instance_logger_modulizer.rb'
115
+
116
+ # Offense count: 1
117
+ Style/MultilineBlockChain:
118
+ Exclude:
119
+ - 'lib/debug_logging/argument_printer.rb'
120
+
121
+ # Offense count: 95
122
+ # Cop supports --auto-correct.
123
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
124
+ # URISchemes: http, https
125
+ Layout/LineLength:
126
+ Max: 223
@@ -9,6 +9,7 @@ before_script:
9
9
  - ./cc-test-reporter before-build
10
10
 
11
11
  script:
12
+ - bundle exec rubocop -DESP --config ./.rubocop_todo.yml
12
13
  - bundle exec rspec
13
14
 
14
15
  after_script:
@@ -29,7 +30,8 @@ language: ruby
29
30
  sudo: false
30
31
 
31
32
  rvm:
32
- - ruby-2.3.7
33
- - ruby-2.4.4
34
- - ruby-2.5.1
35
- - jruby-9.1.9.0
33
+ - ruby-2.3.8
34
+ - ruby-2.4.10
35
+ - ruby-2.5.8
36
+ - ruby-2.6.6
37
+ - ruby-2.7.1
data/Gemfile CHANGED
@@ -1,21 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  group :test do
6
- ruby_version = Gem::Version.new(RUBY_VERSION)
7
- if ruby_version >= Gem::Version.new('2.1')
8
- gem 'rubocop', '~> 0.59.0'
9
- gem 'rubocop-rspec', '~> 1.24.0'
10
- end
11
- if ruby_version >= Gem::Version.new('2.0')
12
- gem 'byebug', '~> 10', platform: :mri, require: false
13
- gem 'pry', '~> 0', platform: :mri, require: false
14
- gem 'pry-byebug', '~> 3', platform: :mri, require: false
15
- end
16
- # NOTE: Switching coveralls to simplecov causing many spec failures.
17
- # Something about coveralls bleeds into this gem, and this gem is
18
- # dependent on that tweaking behavior
19
8
  gem 'coveralls', '~> 0', require: false
20
9
  end
21
10
 
data/README.md CHANGED
@@ -2,11 +2,10 @@
2
2
 
3
3
  Unobtrusive, inheritable-overridable-configurable, drop-in debug logging, that won't leave a mess behind when it is time to remove it.
4
4
 
5
- NOTE: Septmeber 9, 2018 I discovered that some of the functionality of this gem is affected by the presence of the coveralls gem. All specs pass when it is loaded, and about 35% fail when it is not. I am going to figure out why this is. The failures mean that some logging features won't work as configured until I decouple this gem from coveralls.
6
-
7
5
  | Project | DebugLogging |
8
6
  |------------------------ | ----------------------- |
9
7
  | gem name | [debug_logging](https://rubygems.org/gems/debug_logging) |
8
+ | compatibility | Ruby 2.3, 2.4, 2.5, 2.6, 2.7 |
10
9
  | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
11
10
  | download rank | [![Downloads Today](https://img.shields.io/gem/rd/debug_logging.svg)](https://github.com/pboling/debug_logging) |
12
11
  | version | [![Version](https://img.shields.io/gem/v/debug_logging.svg)](https://rubygems.org/gems/debug_logging) |
@@ -19,7 +18,7 @@ NOTE: Septmeber 9, 2018 I discovered that some of the functionality of this gem
19
18
  | documentation | [on RDoc.info][documentation] |
20
19
  | 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) |
21
20
  | 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) |
22
- | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌍 🌎 🌏](https://about.me/peter.boling), [🍚](https://www.crowdrise.com/helprefugeeswithhopefortomorrowliberia/fundraiser/peterboling), [➕](https://plus.google.com/+PeterBoling/posts), [👼](https://angel.co/peter-boling), [🐛](https://www.topcoder.com/members/pboling/), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo) |
21
+ | 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) |
23
22
 
24
23
  ### Gives you (all are optional):
25
24
 
@@ -37,21 +36,14 @@ NOTE: Septmeber 9, 2018 I discovered that some of the functionality of this gem
37
36
 
38
37
  Herein you will find:
39
38
 
40
- * Classes inheriting from Module.
41
- * Cats and dogs sleeping together.
42
- * Zero tolerance policy on monkey patching.
43
- * 100% clean, 0% obtrusive.
44
- * 100% tested.
45
- * 50% Ruby 2.0+ compatible.
46
- * 100% Ruby 2.1+ compatible, and therefore also compatible with JRuby 9000 and later.
47
- * 10g Monosodium glutamate.
39
+ * Classes inheriting from Module
40
+ * Zero tolerance policy on monkey patching
41
+ * 100% clean, 0% obtrusive
42
+ * 100% tested
43
+ * 100% Ruby 2.3+ compatible
48
44
 
49
45
  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.
50
46
 
51
- NOTE: The instance method logging works on Ruby 2.0+
52
-
53
- NOTE: The class method logging works on Ruby 2.1+
54
-
55
47
  ## Installation
56
48
 
57
49
  Add this line to your application's Gemfile:
@@ -210,14 +202,14 @@ dependency on this gem using the [Pessimistic Version Constraint](http://docs.ru
210
202
  For example:
211
203
 
212
204
  ```ruby
213
- spec.add_dependency 'debug_logging', '~> 1.0'
205
+ spec.add_dependency 'debug_logging', '~> 2.0'
214
206
  ```
215
207
 
216
208
  ## License [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
217
209
 
218
210
  MIT License
219
211
 
220
- Copyright (c) 2017 - 2018 [Peter Boling][peterboling] of [RailsBling.com][railsbling]
212
+ Copyright (c) 2017 - 2020 [Peter Boling][peterboling] of [RailsBling.com][railsbling]
221
213
 
222
214
  Permission is hereby granted, free of charge, to any person obtaining
223
215
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "debug_logging"
4
+ require 'bundler/setup'
5
+ require 'debug_logging'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "debug_logging"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
@@ -1,34 +1,38 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'debug_logging/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "debug_logging"
8
+ spec.name = 'debug_logging'
8
9
  spec.version = DebugLogging::VERSION
9
- spec.authors = ["Peter Boling"]
10
- spec.email = ["peter.boling@gmail.com"]
10
+ spec.authors = ['Peter Boling']
11
+ spec.email = ['peter.boling@gmail.com']
11
12
 
12
- spec.summary = %q{Drop-in debug logging useful when a call stack gets unruly}
13
- spec.description = %q{
13
+ spec.summary = 'Drop-in debug logging useful when a call stack gets unruly'
14
+ spec.description = '
14
15
  Unobtrusive debug logging for Ruby. NO LITTERING.
15
16
  Automatically log selected methods and their arguments as they are called at runtime!
16
- }
17
- spec.license = "MIT"
18
- spec.homepage = "https://github.com/pboling/debug_logging"
17
+ '
18
+ spec.license = 'MIT'
19
+ spec.homepage = 'https://github.com/pboling/debug_logging'
19
20
 
20
21
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
22
  f.match(%r{^(test|spec|features)/})
22
23
  end
23
- spec.bindir = "exe"
24
+ spec.bindir = 'exe'
24
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
- spec.require_paths = ["lib"]
26
- spec.required_ruby_version = ">= 2.0.0" # Uses named parameters
26
+ spec.require_paths = ['lib']
27
+ spec.required_ruby_version = '>= 2.3.0' # Uses magic comments
27
28
 
28
- spec.add_runtime_dependency "colorize", "~> 0.8"
29
- spec.add_development_dependency "rspec-pending_for"
30
- spec.add_development_dependency "bundler", "~> 1.14"
31
- spec.add_development_dependency "rake", "~> 12.2"
32
- spec.add_development_dependency "rspec", "~> 3.0"
33
- spec.add_development_dependency "activesupport", "~> 5.1"
29
+ spec.add_runtime_dependency 'colorize', '>= 0'
30
+ spec.add_development_dependency 'bundler', '>= 2'
31
+ spec.add_development_dependency 'byebug', '>= 11'
32
+ spec.add_development_dependency 'rake', '>= 13'
33
+ spec.add_development_dependency 'rspec', '>= 3'
34
+ spec.add_development_dependency 'rspec-pending_for', '>= 0'
35
+ spec.add_development_dependency 'rubocop', '>= 0'
36
+ spec.add_development_dependency 'rubocop-rspec', '>= 1'
37
+ spec.add_development_dependency 'silent_stream', '>= 1'
34
38
  end
@@ -1,13 +1,15 @@
1
- require "logger"
2
- require "colorized_string"
3
- require "digest"
1
+ # frozen_string_literal: true
4
2
 
5
- require "debug_logging/version"
6
- require "debug_logging/configuration"
7
- require "debug_logging/argument_printer"
8
- require "debug_logging/instance_logger_modulizer"
9
- require "debug_logging/instance_logger"
10
- require "debug_logging/class_logger"
3
+ require 'logger'
4
+ require 'colorized_string'
5
+ require 'digest'
6
+
7
+ require 'debug_logging/version'
8
+ require 'debug_logging/configuration'
9
+ require 'debug_logging/argument_printer'
10
+ require 'debug_logging/instance_logger_modulizer'
11
+ require 'debug_logging/instance_logger'
12
+ require 'debug_logging/class_logger'
11
13
 
12
14
  ####################
13
15
  # #
@@ -62,12 +64,12 @@ module DebugLogging
62
64
  end
63
65
 
64
66
  #### API ####
65
- # Not used by this gem internally, but provides an external interface for
67
+ # Not used by this gem internally, but provides an external interface for
66
68
  # classes to also use this logging tool directly,
67
69
  # with configured options like benchmarking, colors, or leg level.
68
70
  def debug_log(message = nil, config_proxy = nil, &block)
69
71
  # If a, instance-method-level, or class-method-level custom config is not
70
- # passed in, then fall back to the class' default config, which is a
72
+ # passed in, then fall back to the class' default config, which is a
71
73
  # potentially customized copy of the default config for the whole app.
72
74
  config_proxy ||= debug_config
73
75
  config_proxy.log(message, &block)
@@ -103,87 +105,115 @@ module DebugLogging
103
105
  def debug_config_reset(config = Configuration.new)
104
106
  @debug_logging_configuration = config
105
107
  end
108
+
106
109
  def debug_enabled
107
110
  @debug_logging_configuration.enabled
108
111
  end
112
+
109
113
  def debug_enabled=(value)
110
114
  @debug_logging_configuration.enabled = value
111
115
  end
116
+
112
117
  def debug_logger
113
118
  @debug_logging_configuration.logger
114
119
  end
120
+
115
121
  def debug_logger=(logger)
116
122
  @debug_logging_configuration.logger = logger
117
123
  end
124
+
118
125
  def debug_log_level
119
126
  @debug_logging_configuration.log_level
120
127
  end
128
+
121
129
  def debug_log_level=(log_level)
122
130
  @debug_logging_configuration.log_level = log_level
123
131
  end
132
+
124
133
  def debug_multiple_last_hashes
125
134
  @debug_logging_configuration.multiple_last_hashes
126
135
  end
136
+
127
137
  def debug_multiple_last_hashes=(multiple_last_hashes)
128
138
  @debug_logging_configuration.multiple_last_hashes = multiple_last_hashes
129
139
  end
140
+
130
141
  def debug_last_hash_to_s_proc
131
142
  @debug_logging_configuration.last_hash_to_s_proc
132
143
  end
144
+
133
145
  def debug_last_hash_to_s_proc=(last_hash_to_s_proc)
134
146
  @debug_logging_configuration.last_hash_to_s_proc = last_hash_to_s_proc
135
147
  end
148
+
136
149
  def debug_last_hash_max_length
137
150
  @debug_logging_configuration.last_hash_max_length
138
151
  end
152
+
139
153
  def debug_last_hash_max_length=(last_hash_max_length)
140
154
  @debug_logging_configuration.last_hash_max_length = last_hash_max_length
141
155
  end
156
+
142
157
  def debug_args_max_length
143
158
  @debug_logging_configuration.args_max_length
144
159
  end
160
+
145
161
  def debug_args_max_length=(args_max_length)
146
162
  @debug_logging_configuration.args_max_length = args_max_length
147
163
  end
164
+
148
165
  def debug_instance_benchmarks
149
166
  @debug_logging_configuration.instance_benchmarks
150
167
  end
168
+
151
169
  def debug_instance_benchmarks=(instance_benchmarks)
152
170
  @debug_logging_configuration.instance_benchmarks = instance_benchmarks
153
171
  end
172
+
154
173
  def debug_class_benchmarks
155
174
  @debug_logging_configuration.class_benchmarks
156
175
  end
176
+
157
177
  def debug_class_benchmarks=(class_benchmarks)
158
178
  @debug_logging_configuration.class_benchmarks = class_benchmarks
159
179
  end
180
+
160
181
  def debug_colorized_chain_for_method
161
182
  @debug_logging_configuration.colorized_chain_for_method
162
183
  end
184
+
163
185
  def debug_colorized_chain_for_method=(colorized_chain_for_method)
164
186
  @debug_logging_configuration.colorized_chain_for_method = colorized_chain_for_method
165
187
  end
188
+
166
189
  def debug_colorized_chain_for_class
167
190
  @debug_logging_configuration.colorized_chain_for_class
168
191
  end
192
+
169
193
  def debug_colorized_chain_for_class=(colorized_chain_for_class)
170
194
  @debug_logging_configuration.colorized_chain_for_class = colorized_chain_for_class
171
195
  end
196
+
172
197
  def debug_add_invocation_id
173
198
  @debug_logging_configuration.add_invocation_id
174
199
  end
200
+
175
201
  def debug_add_invocation_id=(add_invocation_id)
176
202
  @debug_logging_configuration.add_invocation_id = add_invocation_id
177
203
  end
204
+
178
205
  def debug_mark_scope_exit
179
206
  @debug_logging_configuration.mark_scope_exit
180
207
  end
208
+
181
209
  def debug_mark_scope_exit=(mark_scope_exit)
182
210
  @debug_logging_configuration.mark_scope_exit = mark_scope_exit
183
211
  end
212
+
184
213
  def debug_ellipsis
185
214
  @debug_logging_configuration.ellipsis
186
215
  end
216
+
187
217
  def debug_ellipsis=(ellipsis)
188
218
  @debug_logging_configuration.ellipsis = ellipsis
189
219
  end
@@ -1,21 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DebugLogging
2
4
  module ArgumentPrinter
3
5
  def debug_benchmark_to_s(tms: nil)
4
- "completed in #{sprintf("%f", tms.real)}s (#{sprintf("%f", tms.total)}s CPU)"
6
+ "completed in #{format('%f', tms.real)}s (#{format('%f', tms.total)}s CPU)"
5
7
  end
8
+
6
9
  def debug_invocation_id_to_s(args: nil, config_proxy: nil)
7
10
  if config_proxy.debug_add_invocation_id
8
- invocation = " ~#{args.object_id}@#{(Time.now.to_f.to_s % '%#-21a')[4..(-4)]}~"
11
+ invocation = " ~#{args.object_id}@#{(Time.now.to_f.to_s % '%#-21a')[4..-4]}~"
9
12
  case config_proxy.debug_add_invocation_id
10
- when true then
13
+ when true
11
14
  invocation
12
15
  else
13
16
  config_proxy.debug_add_invocation_id.call(ColorizedString[invocation])
14
17
  end
15
18
  else
16
- ""
19
+ ''
17
20
  end
18
21
  end
22
+
19
23
  def debug_invocation_to_s(klass: nil, separator: nil, method_to_log: nil, config_proxy: nil)
20
24
  klass_string = if config_proxy.debug_colorized_chain_for_class
21
25
  config_proxy.debug_colorized_chain_for_class.call(ColorizedString[klass.to_s])
@@ -29,50 +33,55 @@ module DebugLogging
29
33
  end
30
34
  "#{klass_string}#{separator}#{method_string}"
31
35
  end
32
- def debug_signature_to_s(args: nil, config_proxy: nil)
33
- printed_args = ""
36
+
37
+ def debug_signature_to_s(args: nil, config_proxy: nil) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
38
+ printed_args = ''
39
+
34
40
  add_args_ellipsis = false
35
41
  if config_proxy.debug_last_hash_to_s_proc && args[-1].is_a?(Hash)
42
+ add_last_hash_ellipsis = false
36
43
  if args.length > 1
37
- add_last_hash_ellipsis = false
38
44
  if config_proxy.debug_multiple_last_hashes
39
45
  last_hash_args, other_args = args.partition do |arg|
40
- arg.is_a?(Hash)
41
- end
42
- other_args_string = other_args.map(&:inspect).join(", ")[0..(config_proxy.debug_args_max_length)]
43
- # On the debug_multiple_last_hashes truthy branch we don't print the ellipsis after regular args
44
- # because it will go instead after the last hash (if needed)
45
- # ...join(", ").tap {|x| _add_args_ellipsis = x.length > config_proxy.debug_args_max_length}
46
+ arg.is_a?(Hash)
47
+ end
48
+ other_args_string = other_args.map(&:inspect).join(', ')[0..(config_proxy.debug_args_max_length)]
49
+ # On the debug_multiple_last_hashes truthy branch we don't print the ellipsis after regular args
50
+ # because it will go instead after the last hash (if needed)
51
+ # ...join(", ").tap {|x| _add_args_ellipsis = x.length > config_proxy.debug_args_max_length}
46
52
  last_hash_args_string = last_hash_args.map do |arg|
47
- config_proxy.debug_last_hash_to_s_proc.call(arg).to_s.
48
- tap {|x|
49
- add_last_hash_ellipsis = x.length > config_proxy.debug_last_hash_max_length
50
- }[0..(config_proxy.debug_last_hash_max_length)].
51
- tap {|x|
52
- x << config_proxy.debug_ellipsis if add_last_hash_ellipsis
53
- }
54
- end.join(", ")
55
- printed_args << other_args_string if other_args_string
56
- printed_args << ", " if !other_args_string.empty? && !last_hash_args_string.empty?
57
- printed_args << last_hash_args_string if last_hash_args_string
53
+ arr = []
54
+ arr << config_proxy.debug_last_hash_to_s_proc.call(arg).to_s
55
+ .tap do |x|
56
+ add_last_hash_ellipsis = x.length > config_proxy.debug_last_hash_max_length
57
+ end
58
+ if add_last_hash_ellipsis
59
+ arr[-1] = arr[-1][0..(config_proxy.debug_last_hash_max_length)]
60
+ arr << config_proxy.debug_ellipsis
61
+ end
62
+ arr
63
+ end.flatten.join(', ')
64
+ printed_args += other_args_string if other_args_string
65
+ printed_args += ', ' if !other_args_string.empty? && !last_hash_args_string.empty?
66
+ printed_args += last_hash_args_string if last_hash_args_string && !last_hash_args_string.empty?
58
67
  else
59
- printed_args << args[0..(-2)].map {|x| x.inspect}.join(", ").tap {|x| add_args_ellipsis = x.length > config_proxy.debug_args_max_length}[0..(config_proxy.debug_args_max_length)]
60
- printed_args << config_proxy.debug_ellipsis if add_args_ellipsis
61
- printed_args << ", " << config_proxy.debug_last_hash_to_s_proc.call(args[-1]).tap {|x| add_last_hash_ellipsis = x.length > config_proxy.debug_last_hash_max_length}[0..(config_proxy.debug_last_hash_max_length)]
62
- printed_args << config_proxy.debug_ellipsis if add_last_hash_ellipsis
68
+ printed_args += args[0..-2].map(&:inspect).join(', ').tap { |x| add_args_ellipsis = x.length > config_proxy.debug_args_max_length }[0..(config_proxy.debug_args_max_length)]
69
+ printed_args += config_proxy.debug_ellipsis if add_args_ellipsis
70
+ printed_args += ", #{config_proxy.debug_last_hash_to_s_proc.call(args[-1]).tap { |x| add_last_hash_ellipsis = x.length > config_proxy.debug_last_hash_max_length }[0..(config_proxy.debug_last_hash_max_length)]}"
71
+ printed_args += config_proxy.debug_ellipsis if add_last_hash_ellipsis
63
72
  end
64
73
  else
65
- printed_args << String(config_proxy.debug_last_hash_to_s_proc.call(args[0])).tap {|x| add_last_hash_ellipsis = x.length > config_proxy.debug_last_hash_max_length}[0..(config_proxy.debug_last_hash_max_length)]
66
- printed_args << config_proxy.debug_ellipsis if add_last_hash_ellipsis
74
+ printed_args += String(config_proxy.debug_last_hash_to_s_proc.call(args[0])).tap { |x| add_last_hash_ellipsis = x.length > config_proxy.debug_last_hash_max_length }[0..(config_proxy.debug_last_hash_max_length)]
75
+ printed_args += config_proxy.debug_ellipsis if add_last_hash_ellipsis
67
76
  end
68
77
  else
69
78
  if args.length == 1 && args[0].is_a?(Hash)
70
79
  # handle double splat
71
- printed_args << ("**" << args.map {|x| x.inspect}.join(", ").tap {|x| add_args_ellipsis = x.length > config_proxy.debug_args_max_length})[0..(config_proxy.debug_args_max_length)]
80
+ printed_args += ("**#{args.map(&:inspect).join(', ').tap { |x| add_args_ellipsis = x.length > config_proxy.debug_args_max_length }}")[0..(config_proxy.debug_args_max_length)]
72
81
  else
73
- printed_args << args.map {|x| x.inspect}.join(", ").tap {|x| add_args_ellipsis = x.length > config_proxy.debug_args_max_length}[0..(config_proxy.debug_args_max_length)]
82
+ printed_args += args.map(&:inspect).join(', ').tap { |x| add_args_ellipsis = x.length > config_proxy.debug_args_max_length}[0..(config_proxy.debug_args_max_length)]
74
83
  end
75
- printed_args << config_proxy.debug_ellipsis if add_args_ellipsis
84
+ printed_args += config_proxy.debug_ellipsis if add_args_ellipsis
76
85
  end
77
86
  "(#{printed_args})"
78
87
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DebugLogging
2
4
  module ClassLogger
3
5
  def logged(*methods_to_log)
@@ -19,7 +21,7 @@ module DebugLogging
19
21
  proxy
20
22
  else
21
23
  proxy = if opts
22
- Configuration.new(**(debug_config.to_hash.merge(opts)))
24
+ Configuration.new(**debug_config.to_hash.merge(opts))
23
25
  else
24
26
  debug_config
25
27
  end
@@ -31,7 +33,7 @@ module DebugLogging
31
33
  log_prefix = nil
32
34
  invocation_id = nil
33
35
  config_proxy.log do
34
- log_prefix = debug_invocation_to_s(klass: to_s, separator: ".", method_to_log: method_to_log, config_proxy: config_proxy)
36
+ log_prefix = debug_invocation_to_s(klass: to_s, separator: '.', method_to_log: method_to_log, config_proxy: config_proxy)
35
37
  invocation_id = debug_invocation_id_to_s(args: args, config_proxy: config_proxy)
36
38
  signature = debug_signature_to_s(args: args, config_proxy: config_proxy)
37
39
  "#{log_prefix}#{signature}#{invocation_id}"
@@ -1,23 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DebugLogging
2
4
  class Configuration
3
- DEFAULT_ELLIPSIS = " ✂️ …".freeze
5
+ DEFAULT_ELLIPSIS = ' ✂️ …'
4
6
  # For reference, log levels as integers mapped to symbols:
5
7
  # LEVELS = { 0 => :debug, 1 => :info, 2 => :warn, 3 => :error, 4 => :fatal, 5 => :unknown }
6
8
  attr_accessor :enabled
7
- attr_accessor :logger
8
- attr_accessor :log_level
9
- attr_accessor :multiple_last_hashes
10
- attr_accessor :last_hash_to_s_proc
11
- attr_accessor :last_hash_max_length
12
- attr_accessor :args_max_length
13
- attr_accessor :instance_benchmarks
14
- attr_accessor :class_benchmarks
15
- attr_accessor :colorized_chain_for_method
16
- attr_accessor :colorized_chain_for_class
17
- attr_accessor :add_invocation_id
18
- attr_accessor :ellipsis
19
- attr_accessor :mark_scope_exit
20
- attr_reader :methods_to_log
9
+ attr_accessor :logger, :log_level, :multiple_last_hashes, :last_hash_to_s_proc, :last_hash_max_length,
10
+ :args_max_length, :colorized_chain_for_method, :colorized_chain_for_class, :add_invocation_id,
11
+ :ellipsis, :mark_scope_exit
12
+ attr_reader :instance_benchmarks, :class_benchmarks, :methods_to_log
21
13
  # alias the readers to the debug_* prefix so an instance of this class
22
14
  # can have the same API granted by `extend DebugLogging`
23
15
  #
@@ -36,21 +28,21 @@ module DebugLogging
36
28
  # }
37
29
  # )
38
30
  #
39
- alias :debug_enabled :enabled
40
- alias :debug_logger :logger
41
- alias :debug_log_level :log_level
42
- alias :debug_multiple_last_hashes :multiple_last_hashes
43
- alias :debug_last_hash_to_s_proc :last_hash_to_s_proc
44
- alias :debug_last_hash_max_length :last_hash_max_length
45
- alias :debug_args_max_length :args_max_length
46
- alias :debug_instance_benchmarks :instance_benchmarks
47
- alias :debug_class_benchmarks :class_benchmarks
48
- alias :debug_colorized_chain_for_method :colorized_chain_for_method
49
- alias :debug_colorized_chain_for_class :colorized_chain_for_class
50
- alias :debug_add_invocation_id :add_invocation_id
51
- alias :debug_ellipsis :ellipsis
52
- alias :debug_mark_scope_exit :mark_scope_exit
53
-
31
+ alias debug_enabled enabled
32
+ alias debug_logger logger
33
+ alias debug_log_level log_level
34
+ alias debug_multiple_last_hashes multiple_last_hashes
35
+ alias debug_last_hash_to_s_proc last_hash_to_s_proc
36
+ alias debug_last_hash_max_length last_hash_max_length
37
+ alias debug_args_max_length args_max_length
38
+ alias debug_instance_benchmarks instance_benchmarks
39
+ alias debug_class_benchmarks class_benchmarks
40
+ alias debug_colorized_chain_for_method colorized_chain_for_method
41
+ alias debug_colorized_chain_for_class colorized_chain_for_class
42
+ alias debug_add_invocation_id add_invocation_id
43
+ alias debug_ellipsis ellipsis
44
+ alias debug_mark_scope_exit mark_scope_exit
45
+
54
46
  class << self
55
47
  def config_pointer(type, method_to_log)
56
48
  # Methods names that do not match the following regex can't be part of an ivar name
@@ -61,7 +53,7 @@ module DebugLogging
61
53
  end
62
54
  def initialize(**options)
63
55
  @enabled = options.key?(:enabled) ? options[:enabled] : true
64
- @logger = options.key?(:logger) ? options[:logger] : Logger.new(STDOUT)
56
+ @logger = options.key?(:logger) ? options[:logger] : Logger.new($stdout)
65
57
  @log_level = options.key?(:log_level) ? options[:log_level] : :debug
66
58
  @multiple_last_hashes = options.key?(:multiple_last_hashes) ? options[:multiple_last_hashes] : false
67
59
  @last_hash_to_s_proc = options.key?(:last_hash_to_s_proc) ? options[:last_hash_to_s_proc] : nil
@@ -76,52 +68,64 @@ module DebugLogging
76
68
  @mark_scope_exit = options.key?(:mark_scope_exit) ? options[:mark_scope_exit] : false
77
69
  @methods_to_log = []
78
70
  end
71
+
79
72
  def log(message = nil, &block)
80
73
  return unless enabled
81
74
  return unless logger
75
+
82
76
  if block_given?
83
77
  logger.send(log_level, &block)
84
78
  else
85
79
  logger.send(log_level, message)
86
80
  end
87
81
  end
82
+
88
83
  def loggable?
89
84
  return @loggable if defined?(@loggable)
85
+
90
86
  @loggable = logger.send("#{log_level}?")
91
87
  end
88
+
92
89
  def benchmarkable_for?(benchmarks)
93
90
  return @benchmarkable if defined?(@benchmarkable)
94
- @benchmarkable = loggable? && self.send(benchmarks)
91
+
92
+ @benchmarkable = loggable? && send(benchmarks)
95
93
  end
94
+
96
95
  def exit_scope_markable?
97
96
  return @exit_scope_markable if defined?(@exit_scope_markable)
97
+
98
98
  @exit_scope_markable = loggable? && mark_scope_exit
99
99
  end
100
+
100
101
  def instance_benchmarks=(instance_benchmarks)
101
- require "benchmark" if instance_benchmarks
102
+ require 'benchmark' if instance_benchmarks
102
103
  @instance_benchmarks = instance_benchmarks
103
104
  end
105
+
104
106
  def class_benchmarks=(class_benchmarks)
105
- require "benchmark" if class_benchmarks
107
+ require 'benchmark' if class_benchmarks
106
108
  @class_benchmarks = class_benchmarks
107
109
  end
110
+
108
111
  def to_hash
109
112
  {
110
- logger: logger,
111
- log_level: log_level,
112
- multiple_last_hashes: multiple_last_hashes,
113
- last_hash_to_s_proc: last_hash_to_s_proc,
114
- last_hash_max_length: last_hash_max_length,
115
- args_max_length: args_max_length,
116
- instance_benchmarks: instance_benchmarks,
117
- class_benchmarks: class_benchmarks,
118
- colorized_chain_for_method: colorized_chain_for_method,
119
- colorized_chain_for_class: colorized_chain_for_class,
120
- add_invocation_id: add_invocation_id,
121
- ellipsis: ellipsis,
122
- mark_scope_exit: mark_scope_exit
113
+ logger: logger,
114
+ log_level: log_level,
115
+ multiple_last_hashes: multiple_last_hashes,
116
+ last_hash_to_s_proc: last_hash_to_s_proc,
117
+ last_hash_max_length: last_hash_max_length,
118
+ args_max_length: args_max_length,
119
+ instance_benchmarks: instance_benchmarks,
120
+ class_benchmarks: class_benchmarks,
121
+ colorized_chain_for_method: colorized_chain_for_method,
122
+ colorized_chain_for_class: colorized_chain_for_class,
123
+ add_invocation_id: add_invocation_id,
124
+ ellipsis: ellipsis,
125
+ mark_scope_exit: mark_scope_exit
123
126
  }
124
127
  end
128
+
125
129
  def register(method_lo_log)
126
130
  @methods_to_log << method_lo_log
127
131
  end
@@ -1,11 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DebugLogging
2
4
  class InstanceLogger < Module
3
5
  def initialize(i_methods: nil, config: nil)
6
+ super()
4
7
  @config = config
5
8
  @instance_methods_to_log = Array(i_methods) if i_methods
6
9
  end
10
+
7
11
  def included(base)
8
12
  return unless @instance_methods_to_log
13
+
9
14
  base.send(:include, ArgumentPrinter)
10
15
  instance_method_logger = DebugLogging::InstanceLoggerModulizer.to_mod(methods_to_log: @instance_methods_to_log, config: @config)
11
16
  base.send(:prepend, instance_method_logger)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DebugLogging
2
4
  module InstanceLoggerModulizer
3
5
  def self.to_mod(methods_to_log: nil, config: nil)
@@ -10,7 +12,7 @@ module DebugLogging
10
12
  proxy
11
13
  else
12
14
  proxy = if config
13
- Configuration.new(**(self.class.debug_config.to_hash.merge(config)))
15
+ Configuration.new(**self.class.debug_config.to_hash.merge(config))
14
16
  else
15
17
  self.class.debug_config
16
18
  end
@@ -18,7 +20,7 @@ module DebugLogging
18
20
  instance_variable_set(DebugLogging::Configuration.config_pointer('i', method_to_log), proxy)
19
21
  proxy
20
22
  end
21
- log_prefix = self.class.debug_invocation_to_s(klass: self.class.to_s, separator: "#", method_to_log: method_to_log, config_proxy: config_proxy)
23
+ log_prefix = self.class.debug_invocation_to_s(klass: self.class.to_s, separator: '#', method_to_log: method_to_log, config_proxy: config_proxy)
22
24
  invocation_id = self.class.debug_invocation_id_to_s(args: args, config_proxy: config_proxy)
23
25
  config_proxy.log do
24
26
  signature = self.class.debug_signature_to_s(args: args, config_proxy: config_proxy)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DebugLogging
2
- VERSION = "1.0.17"
4
+ VERSION = '2.0.0'
3
5
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Simpler version of what the sibling DebugLogging library does. Included as a bauble.
2
4
  #
3
5
  ############# THIS IS A BAUBLE
4
6
  ############# FOR EXAMINING SEVERAL OF THE WONDERS OF RUBY
5
7
  ############# TO ACCOMPLISH SOMETHING PRACTICAL
6
- ############# For a more robust implementation use the gem debug_logging itself,
8
+ ############# For a more robust implementation use the gem debug_logging itself,
7
9
  ############# which makes use of these same principles.
8
10
  #
9
11
  # Automatically log Class.method(arguments) as they are called at runtime (instance or singleton)!
@@ -39,8 +41,10 @@ require 'benchmark'
39
41
 
40
42
  class SimpleDebugLogging < Module
41
43
  def initialize(i_methods: nil)
44
+ super()
42
45
  @instance_methods_to_log = Array(i_methods) if i_methods
43
46
  end
47
+
44
48
  def included(base)
45
49
  instance_method_logger = InstanceMethodLoggerModulizer.to_mod(@instance_methods_to_log)
46
50
  base.send(:prepend, instance_method_logger)
@@ -54,7 +58,7 @@ class SimpleDebugLogging < Module
54
58
  define_method(method_to_log.to_sym) do |*args|
55
59
  method_return_value = nil
56
60
  invocation_id = " ~#{args.object_id}@#{Time.now.to_i}~" if args
57
- puts "#{self}.#{method_to_log}(#{args.map {|x| x.inspect}.join(", ")})#{invocation_id}"
61
+ puts "#{self}.#{method_to_log}(#{args.map(&:inspect).join(', ')})#{invocation_id}"
58
62
  elapsed = Benchmark.realtime do
59
63
  method_return_value = original_method.call(*args)
60
64
  end
@@ -72,7 +76,7 @@ class SimpleDebugLogging < Module
72
76
  define_method(method_to_log.to_sym) do |*args, &block|
73
77
  method_return_value = nil
74
78
  invocation_id = " ~#{args.object_id}@#{Time.now.to_i}~" if args
75
- puts "#{self.class}##{method_to_log}(#{args.map {|x| x.inspect}.join(", ")})#{invocation_id}"
79
+ puts "#{self.class}##{method_to_log}(#{args.map(&:inspect).join(', ')})#{invocation_id}"
76
80
  elapsed = Benchmark.realtime do
77
81
  method_return_value = super(*args, &block)
78
82
  end
metadata CHANGED
@@ -1,99 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debug_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-10 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.8'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.8'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec-pending_for
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
42
+ name: byebug
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.14'
47
+ version: '11'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.14'
54
+ version: '11'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '12.2'
61
+ version: '13'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '12.2'
68
+ version: '13'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '3'
83
83
  - !ruby/object:Gem::Dependency
84
- name: activesupport
84
+ name: rspec-pending_for
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '5.1'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: silent_stream
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '1'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
95
137
  - !ruby/object:Gem::Version
96
- version: '5.1'
138
+ version: '1'
97
139
  description: |2
98
140
 
99
141
  Unobtrusive debug logging for Ruby. NO LITTERING.
@@ -107,6 +149,8 @@ files:
107
149
  - ".coveralls.yml"
108
150
  - ".gitignore"
109
151
  - ".rspec"
152
+ - ".rubocop.yml"
153
+ - ".rubocop_todo.yml"
110
154
  - ".travis.yml"
111
155
  - Gemfile
112
156
  - README.md
@@ -134,15 +178,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
178
  requirements:
135
179
  - - ">="
136
180
  - !ruby/object:Gem::Version
137
- version: 2.0.0
181
+ version: 2.3.0
138
182
  required_rubygems_version: !ruby/object:Gem::Requirement
139
183
  requirements:
140
184
  - - ">="
141
185
  - !ruby/object:Gem::Version
142
186
  version: '0'
143
187
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.7.7
188
+ rubygems_version: 3.1.4
146
189
  signing_key:
147
190
  specification_version: 4
148
191
  summary: Drop-in debug logging useful when a call stack gets unruly