debug_logging 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd9ac9873cb177a6864e30599bdcfe3093837415
4
- data.tar.gz: cde61e395a53bf5289ead7d0cd823de06c2925a3
3
+ metadata.gz: a37d3585c93fa04bc4ad9787908021c2923e7d9d
4
+ data.tar.gz: a41d5e4b7f1a8a87d162ca42d713389133c9e79e
5
5
  SHA512:
6
- metadata.gz: 31bf8b39f62289b7bf0e8ef845cdca2a8049ba492ce259ba9c19b2cf11fb364a004228d710e1d791ef6c83251e029a8f65c884ff0bcff03d39d901a47a7299c6
7
- data.tar.gz: f6a1ec5e93ad0c074a3fa91ff50a676db59afaff1406d7b382616cfc383a54690769e763ef1b4b2d9f7bd7342c0446e903b71a633857e1dfd9eaaba9d63bfc29
6
+ metadata.gz: c276c044a9d874fe55606bf82b8bc8b4f3c6d0e83abfd96f621b1dd29e9593aab6048e72cb13e33abc0ffab91405e06f6e37788f25cbc177caf331b35cbd1cb3
7
+ data.tar.gz: c382d925bbd86b4dbdd4b21bfc2615845c98a257d665a6453f131516a79d0b8a6f33ab2224eaa4722b1c661579eb219ba02e4260448a71962c70bbf1467ec768
data/lib/debug_logging.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "logger"
2
2
  require "colorized_string"
3
+ require "digest"
4
+
3
5
  require "debug_logging/version"
4
6
  require "debug_logging/configuration"
5
7
  require "debug_logging/argument_printer"
@@ -15,7 +15,7 @@ module DebugLogging
15
15
  original_method = method(method_to_log)
16
16
  (class << self; self; end).class_eval do
17
17
  define_method(method_to_log) do |*args, &block|
18
- config_proxy = if (proxy = instance_variable_get("@debug_config_proxy_for_k_#{method_to_log}".to_sym))
18
+ config_proxy = if (proxy = instance_variable_get(DebugLogging::Configuration.config_pointer('k', method_to_log)))
19
19
  proxy
20
20
  else
21
21
  proxy = if opts
@@ -24,7 +24,7 @@ module DebugLogging
24
24
  debug_config
25
25
  end
26
26
  proxy.register(method_to_log)
27
- instance_variable_set("@debug_config_proxy_for_k_#{method_to_log}".to_sym, proxy)
27
+ instance_variable_set(DebugLogging::Configuration.config_pointer('k', method_to_log), proxy)
28
28
  proxy
29
29
  end
30
30
  method_return_value = nil
@@ -47,6 +47,15 @@ module DebugLogging
47
47
  alias :debug_add_invocation_id :add_invocation_id
48
48
  alias :debug_ellipsis :ellipsis
49
49
  alias :debug_mark_scope_exit :mark_scope_exit
50
+
51
+ class << self
52
+ def config_pointer(type, method_to_log)
53
+ # Methods names that do not match the following regex can't be part of an ivar name
54
+ # /[a-zA-Z_][a-zA-Z0-9_]*/
55
+ # Thus we have to use a different form of the method name that is compatible with ivar name conventions
56
+ "@debug_logging_config_#{type}_#{Digest::MD5.hexdigest(method_to_log.to_s)}".to_sym
57
+ end
58
+ end
50
59
  def initialize(**options)
51
60
  @logger = options.key?(:logger) ? options[:logger] : Logger.new(STDOUT)
52
61
  @log_level = options.key?(:log_level) ? options[:log_level] : :debug
@@ -6,7 +6,7 @@ module DebugLogging
6
6
  # method name must be a symbol
7
7
  define_method(method_to_log.to_sym) do |*args, &block|
8
8
  method_return_value = nil
9
- config_proxy = if (proxy = instance_variable_get("@debug_config_proxy_for_#{method_to_log}".to_sym))
9
+ config_proxy = if (proxy = instance_variable_get(DebugLogging::Configuration.config_pointer('i', method_to_log)))
10
10
  proxy
11
11
  else
12
12
  proxy = if config
@@ -15,7 +15,7 @@ module DebugLogging
15
15
  self.class.debug_config
16
16
  end
17
17
  proxy.register(method_to_log)
18
- instance_variable_set("@debug_config_proxy_for_#{method_to_log}".to_sym, proxy)
18
+ instance_variable_set(DebugLogging::Configuration.config_pointer('i', method_to_log), proxy)
19
19
  proxy
20
20
  end
21
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)
@@ -1,3 +1,3 @@
1
1
  module DebugLogging
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debug_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling