• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pboling / debug_logging / 8114731249

01 Mar 2024 05:11PM UTC coverage: 92.479% (+0.7%) from 91.789%
8114731249

push

github

pboling
🐛 Added missing debug_* methods

136 of 158 branches covered (86.08%)

Branch coverage included in aggregate %.

7 of 11 new or added lines in 2 files covered. (63.64%)

8 existing lines in 3 files now uncovered.

528 of 560 relevant lines covered (94.29%)

136.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.05
/lib/debug_logging/instance_logger_modulizer.rb
1
module DebugLogging
1✔
2
  module InstanceLoggerModulizer
1✔
3
    class << self
1✔
4
      def to_mod(methods_to_log: nil, payload: nil, config: nil)
1✔
5
        Module.new do
182✔
6
          methods_to_log, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
182✔
7
            method_names: Array(methods_to_log),
8
            payload:,
9
            config:,
10
          )
11
          Array(methods_to_log).each do |method_to_log|
182✔
12
            method_to_log, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
182✔
13
              method_names: method_to_log,
14
              payload:,
15
              config: config_opts,
16
            )
17
            define_method(method_to_log) do |*args, **kwargs, &block|
182✔
18
              method_return_value = nil
65✔
19
              config_proxy = DebugLogging::Util.config_proxy_finder(
65✔
20
                scope: self.class,
21
                config_opts: method_config_opts,
22
                method_name: method_to_log,
23
                proxy_ref: "ilm",
24
              )
25
              log_prefix = self.class.debug_invocation_to_s(
65✔
26
                klass: self.class.to_s,
27
                separator: "#",
28
                method_to_log: method_to_log,
29
                config_proxy: config_proxy,
30
              )
31
              start_at = Time.now
65✔
32
              start_timestamp = self.class.debug_time_to_s(start_at, config_proxy:)
65✔
33
              invocation_id = self.class.debug_invocation_id_to_s(args:, kwargs:, start_at:, config_proxy:)
65✔
34
              config_proxy.log do
65✔
35
                paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: self, payload: method_payload)
63✔
36
                signature = self.class.debug_signature_to_s(args:, kwargs:, config_proxy:)
63✔
37
                paymud = debug_payload_to_s(payload: paydirt, config_proxy:)
63✔
38
                "#{start_timestamp}#{log_prefix}#{signature}#{invocation_id} debug: #{paymud}"
63✔
39
              end
40
              if config_proxy.benchmarkable_for?(:debug_instance_benchmarks)
65✔
41
                tms = Benchmark.measure do
23✔
42
                  method_return_value = super(*args, **kwargs, &block)
23✔
43
                end
44
                end_timestamp = self.class.debug_time_to_s(Time.now, config_proxy:)
23✔
45
                config_proxy.log do
23✔
46
                  "#{end_timestamp}#{log_prefix} #{self.class.debug_benchmark_to_s(tms: tms)}#{invocation_id}"
23✔
47
                end
48
              else
49
                begin
42✔
50
                  method_return_value = super(*args, **kwargs, &block)
42✔
51
                rescue StandardError => e
52
                  if config_proxy.error_handler_proc
×
UNCOV
53
                    config_proxy.error_handler_proc.call(config_proxy, e, self, method_to_log, args, kwargs)
×
54
                  else
×
UNCOV
55
                    raise e
×
56
                  end
57
                end
58
                if config_proxy.exit_scope_markable? && invocation_id && !invocation_id.empty?
42!
UNCOV
59
                  end_timestamp = self.class.debug_time_to_s(Time.now, config_proxy:)
×
UNCOV
60
                  config_proxy.log do
×
UNCOV
61
                    "#{end_timestamp}#{log_prefix} completed#{invocation_id}"
×
62
                  end
63
                end
64
              end
65
              method_return_value
65✔
66
            end
67
          end
68
        end
69
      end
70
    end
71
  end
72
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc