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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a37d3585c93fa04bc4ad9787908021c2923e7d9d
|
4
|
+
data.tar.gz: a41d5e4b7f1a8a87d162ca42d713389133c9e79e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c276c044a9d874fe55606bf82b8bc8b4f3c6d0e83abfd96f621b1dd29e9593aab6048e72cb13e33abc0ffab91405e06f6e37788f25cbc177caf331b35cbd1cb3
|
7
|
+
data.tar.gz: c382d925bbd86b4dbdd4b21bfc2615845c98a257d665a6453f131516a79d0b8a6f33ab2224eaa4722b1c661579eb219ba02e4260448a71962c70bbf1467ec768
|
data/lib/debug_logging.rb
CHANGED
@@ -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(
|
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(
|
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(
|
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(
|
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)
|