debug_logging 4.0.0 → 4.0.2

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.
@@ -1,23 +1,27 @@
1
1
  module DebugLogging
2
2
  module Constants
3
3
  DEFAULT_ELLIPSIS = " ✂️ …"
4
+ DEFAULT_TIME_FORMATTER = ->(time) { "[#{time.strftime("%Y%m%d %H:%M:%S")}] " }
5
+ EVENT_TIME_FORMATTER = ->(time) { time.strftime("%F %T %z") }
4
6
  CONFIG_ATTRS_DEFAULTS = {
5
7
  enabled: true,
6
- logger: Logger.new($stdout),
7
- log_level: :debug,
8
+ logger: Logger.new($stdout), # probably want to override to be the Rails.logger
9
+ log_level: :debug, # at what level do the messages created by this gem sent at?
8
10
  multiple_last_hashes: false,
9
- last_hash_to_s_proc: nil,
11
+ last_hash_to_s_proc: nil, # e.g. ->(hash) { "keys: #{hash.keys}" }
10
12
  last_hash_max_length: 1_000,
11
- args_to_s_proc: nil,
13
+ args_to_s_proc: nil, # e.g. ->(*record) { "record id: #{record.first.id}" }
12
14
  args_max_length: 1_000,
13
- colorized_chain_for_method: false,
14
- colorized_chain_for_class: false,
15
- add_invocation_id: true,
15
+ colorized_chain_for_method: false, # e.g. ->(colorized_string) { colorized_string.red.on_blue.underline }
16
+ colorized_chain_for_class: false, # e.g. ->(colorized_string) { colorized_string.colorize(:light_blue ).colorize( :background => :red) }
17
+ add_invocation_id: true, # allows unique identification of method call; association of entry and exit log lines
16
18
  ellipsis: DEFAULT_ELLIPSIS,
17
19
  mark_scope_exit: false,
18
20
  add_payload: true, # Can also be a proc returning a string, which will be called when printing the payload
19
21
  payload_max_length: 1_000,
20
22
  error_handler_proc: nil,
23
+ time_formatter_proc: DEFAULT_TIME_FORMATTER,
24
+ add_timestamp: false,
21
25
  }.freeze
22
26
  CONFIG_ATTRS = CONFIG_ATTRS_DEFAULTS.keys
23
27
  CONFIG_READERS_DEFAULTS = {
@@ -3,12 +3,14 @@ require "timeout"
3
3
 
4
4
  module DebugLogging
5
5
  module Hooks
6
- def self.included(mod)
7
- mod.extend(ClassMethods)
8
- end
6
+ class << self
7
+ def included(mod)
8
+ mod.extend(ClassMethods)
9
+ end
9
10
 
10
- def self.extend(mod)
11
- mod.extend(ClassMethods)
11
+ def extended(mod)
12
+ mod.extend(ClassMethods)
13
+ end
12
14
  end
13
15
 
14
16
  module ClassMethods
@@ -1,5 +1,33 @@
1
1
  module DebugLogging
2
2
  module InstanceLogger
3
+ class << self
4
+ def extended(base)
5
+ base.include(LambDartable::Log)
6
+ end
7
+ end
8
+
9
+ # NOTE: These params can be passed in / hidden in a last hash of *args
10
+ # NOTE: They can also be passed in discretely for each method, by passing *args as an array of arrays
11
+ # TODO: Refactor to use modern Ruby 3 *args, **kwargs instead
12
+ # @param logger [Logger] Logger.new($stdout), # probably want to override to be the Rails.logger
13
+ # @param log_level [Symbol] default: :debug, at what level do the messages created by this gem sent at?
14
+ # @param multiple_last_hashes [true, false] default: false,
15
+ # @param last_hash_to_s_proc [nil, Proc] default: nil, e.g. ->(hash) { "keys: #{hash.keys}" }
16
+ # @param last_hash_max_length [Integer] default: 1_000,
17
+ # @param args_to_s_proc [nil, Proc] default: nil, e.g. ->(*record) { "record id: #{record.first.id}" }
18
+ # @param args_max_length [Integer] default: 1_000,
19
+ # @param colorized_chain_for_method [false, Proc] default: false, e.g. ->(colorized_string) { colorized_string.red.on_blue.underline }
20
+ # @param colorized_chain_for_class [false, Proc] default: false, e.g. ->(colorized_string) { colorized_string.colorize(:light_blue ).colorize( :background => :red) }
21
+ # @param add_invocation_id [true, false] default: true, allows unique identification of method call; association of entry and exit log lines
22
+ # @param ellipsis [String] default: " ✂️ …".freeze,
23
+ # @param mark_scope_exit [true, false] default: false,
24
+ # @param add_payload [true, false, Proc] default: true, # Can also be a proc returning a string, which will be called when printing the payload
25
+ # @param payload_max_length [Integer] default: 1_000,
26
+ # @param error_handler_proc [nil, Proc] default: nil,
27
+ # @param time_formatter_proc [nil, Proc] default: DebugLogging::Constants::DEFAULT_TIME_FORMATTER,
28
+ # @param add_timestamp [true, false] default: false,
29
+ # @param instance_benchmarks [true, false] default: false,
30
+ # @param class_benchmarks [true, false] default: false,
3
31
  def i_logged(*methods_to_log)
4
32
  methods_to_log, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
5
33
  method_names: methods_to_log,
@@ -7,9 +35,9 @@ module DebugLogging
7
35
  config: nil,
8
36
  )
9
37
  instance_method_modules =
10
- Array(methods_to_log).map do |method_to_log|
38
+ Array(methods_to_log).map do |decorated_method|
11
39
  DebugLogging::InstanceLoggerModulizer.to_mod(
12
- methods_to_log: Array(method_to_log),
40
+ methods_to_log: Array(decorated_method),
13
41
  payload: payload,
14
42
  config: config_opts,
15
43
  )
@@ -8,57 +8,31 @@ module DebugLogging
8
8
  payload:,
9
9
  config:,
10
10
  )
11
- Array(methods_to_log).each do |method_to_log|
12
- method_to_log, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
13
- method_names: method_to_log,
11
+ Array(methods_to_log).each do |decorated_method|
12
+ decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
13
+ method_names: decorated_method,
14
14
  payload:,
15
15
  config: config_opts,
16
16
  )
17
- define_method(method_to_log) do |*args, **kwargs, &block|
18
- method_return_value = nil
19
- config_proxy = DebugLogging::Util.config_proxy_finder(
20
- scope: self.class,
21
- config_opts: method_config_opts,
22
- method_name: method_to_log,
23
- proxy_ref: "ilm",
17
+ define_method(decorated_method) do |*args, **kwargs, &block|
18
+ lamb_dart = LambDart::Log.new(
19
+ instance: self,
20
+ method_config_opts:,
21
+ method_payload:,
22
+ args:,
23
+ kwargs:,
24
+ decorated_method:,
24
25
  )
25
- log_prefix = self.class.debug_invocation_to_s(
26
- klass: self.class.to_s,
27
- separator: "#",
28
- method_to_log: method_to_log,
29
- config_proxy: config_proxy,
30
- )
31
- invocation_id = self.class.debug_invocation_id_to_s(args:, kwargs:, config_proxy:)
32
- config_proxy.log do
33
- paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: self, payload: method_payload)
34
- signature = self.class.debug_signature_to_s(args:, kwargs:, config_proxy:)
35
- paymud = debug_payload_to_s(payload: paydirt, config_proxy:)
36
- "#{log_prefix}#{signature}#{invocation_id} debug: #{paymud}"
37
- end
38
- if config_proxy.benchmarkable_for?(:debug_instance_benchmarks)
39
- tms = Benchmark.measure do
40
- method_return_value = super(*args, **kwargs, &block)
41
- end
42
- config_proxy.log do
43
- "#{log_prefix} #{self.class.debug_benchmark_to_s(tms: tms)}#{invocation_id}"
44
- end
45
- else
46
- begin
47
- method_return_value = super(*args, **kwargs, &block)
48
- rescue StandardError => e
49
- if config_proxy.error_handler_proc
50
- config_proxy.error_handler_proc.call(config_proxy, e, self, method_to_log, args, kwargs)
51
- else
52
- raise e
53
- end
54
- end
55
- if config_proxy.exit_scope_markable? && invocation_id && !invocation_id.empty?
56
- config_proxy.log do
57
- "#{log_prefix} completed#{invocation_id}"
58
- end
26
+ real_mccoy = ->() {
27
+ super(*args, **kwargs, &block)
28
+ }
29
+ _dl_ld_enter_log(lamb_dart) do
30
+ _dl_ld_error_handle(lamb_dart) do
31
+ return _dl_ld_benchmarked(lamb_dart) { real_mccoy.call } if lamb_dart.bench?
32
+
33
+ _dl_ld_exit_log(lamb_dart) { real_mccoy.call }
59
34
  end
60
35
  end
61
- method_return_value
62
36
  end
63
37
  end
64
38
  end
@@ -1,5 +1,11 @@
1
1
  module DebugLogging
2
2
  module InstanceNotifier
3
+ class << self
4
+ def extended(base)
5
+ base.include(LambDartable::Note)
6
+ end
7
+ end
8
+
3
9
  def i_notified(*methods_to_log)
4
10
  method_names, payload, config_opts = DebugLogging::Util.extract_payload_and_config(
5
11
  method_names: methods_to_log,
@@ -8,40 +8,24 @@ module DebugLogging
8
8
  payload:,
9
9
  config:,
10
10
  )
11
- Array(methods_to_notify).each do |method_to_notify|
12
- method_to_notify, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
13
- method_names: method_to_notify,
11
+ Array(methods_to_notify).each do |decorated_method|
12
+ decorated_method, method_payload, method_config_opts = DebugLogging::Util.extract_payload_and_config(
13
+ method_names: decorated_method,
14
14
  payload:,
15
15
  config: config_opts,
16
16
  )
17
- define_method(method_to_notify) do |*args, **kwargs, &block|
18
- config_proxy = DebugLogging::Util.config_proxy_finder(
19
- scope: self.class,
20
- config_opts: method_config_opts,
21
- method_name: method_to_notify,
22
- proxy_ref: "inm",
23
- ) do |config_proxy|
24
- ActiveSupport::Notifications.subscribe(
25
- DebugLogging::ArgumentPrinter.debug_event_name_to_s(method_to_notify:),
26
- ) do |*subscribe_args|
27
- config_proxy&.log do
28
- DebugLogging::LogSubscriber.log_event(ActiveSupport::Notifications::Event.new(*subscribe_args))
29
- end
30
- end
31
- end
32
- paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: self, payload: method_payload)
33
- ActiveSupport::Notifications.instrument(
34
- DebugLogging::ArgumentPrinter.debug_event_name_to_s(method_to_notify:),
35
- debug_args: kwargs.empty? ? args : args + [kwargs],
36
- config_proxy: config_proxy,
37
- **paydirt,
38
- ) do
39
- super(*args, **kwargs, &block)
40
- rescue StandardError => e
41
- if config_proxy.error_handler_proc
42
- config_proxy.error_handler_proc.call(config_proxy, e, self, method_to_notify, args, kwargs)
43
- else
44
- raise e
17
+ define_method(decorated_method) do |*args, **kwargs, &block|
18
+ lamb_dart = LambDart::Note.new(
19
+ instance: self,
20
+ method_config_opts:,
21
+ method_payload:,
22
+ args:,
23
+ kwargs:,
24
+ decorated_method:,
25
+ )
26
+ _dl_ld_notify(lamb_dart) do
27
+ _dl_ld_error_handle(lamb_dart) do
28
+ super(*args, **kwargs, &block)
45
29
  end
46
30
  end
47
31
  end
@@ -0,0 +1,46 @@
1
+ require "forwardable"
2
+
3
+ module DebugLogging
4
+ module LambDart
5
+ class Base
6
+ extend Forwardable
7
+
8
+ attr_reader :instance, # For ClassLogger, this will be the same as klass
9
+ :klass,
10
+ :is_class,
11
+ :config_proxy,
12
+ :method_payload,
13
+ :args,
14
+ :kwargs,
15
+ :scope_term,
16
+ :decorated_method
17
+
18
+ def_delegator :@config_proxy, :error_handler_proc
19
+
20
+ def initialize(instance: nil, klass: nil, method_config_opts:, method_payload:, args:, kwargs:, decorated_method:)
21
+ @instance = instance || klass
22
+ @klass = klass || instance.class
23
+ @method_payload = method_payload
24
+ @args = args
25
+ @kwargs = kwargs
26
+ @decorated_method = decorated_method
27
+ @is_class = (self.klass == self.instance)
28
+ @scope_term = is_class ? "class" : "instance"
29
+ @config_proxy = DebugLogging::Util.config_proxy_finder(
30
+ scope: self.klass,
31
+ config_opts: method_config_opts,
32
+ method_name: self.decorated_method,
33
+ proxy_ref:,
34
+ ) do |proxy|
35
+ yield proxy if block_given?
36
+ end
37
+ end
38
+
39
+ private
40
+
41
+ def proxy_ref
42
+ raise "#{self.class}##{__method__} is not defined, please fix!"
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,47 @@
1
+ module DebugLogging
2
+ module LambDart
3
+ class Log < Base
4
+ attr_reader :log_prefix,
5
+ :invocation_id,
6
+ :start_at
7
+
8
+ def initialize(...)
9
+ @start_at = Time.now
10
+ super
11
+ @log_prefix = klass.debug_invocation_to_s(
12
+ klass: klass.to_s,
13
+ separator: is_class ? "::" : "#",
14
+ decorated_method:,
15
+ config_proxy:,
16
+ )
17
+ @invocation_id = klass.debug_invocation_id_to_s(args:, config_proxy:)
18
+ end
19
+
20
+ def end_timestamp
21
+ klass.debug_time_to_s(Time.now, config_proxy:)
22
+ end
23
+
24
+ def benchmarked(tms)
25
+ klass.debug_benchmark_to_s(tms: tms)
26
+ end
27
+
28
+ def mark_exit_scope?
29
+ config_proxy.exit_scope_markable? && invocation_id && !invocation_id.empty?
30
+ end
31
+
32
+ def bench_scope
33
+ "debug_#{scope_term}_benchmarks".to_sym
34
+ end
35
+
36
+ def bench?
37
+ config_proxy.benchmarkable_for?(bench_scope)
38
+ end
39
+
40
+ private
41
+
42
+ def proxy_ref
43
+ is_class ? "kl" : "ilm"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,30 @@
1
+ module DebugLogging
2
+ module LambDart
3
+ class Note < Base
4
+ attr_reader :debug_args
5
+
6
+ def initialize(...)
7
+ super do |proxy|
8
+ subscribe(proxy)
9
+ end
10
+ @debug_args = kwargs.empty? ? args : args + [kwargs]
11
+ end
12
+
13
+ private
14
+
15
+ def subscribe(proxy)
16
+ ActiveSupport::Notifications.subscribe(
17
+ DebugLogging::ArgumentPrinter.debug_event_name_to_s(decorated_method: decorated_method),
18
+ ) do |*subscribe_args|
19
+ proxy.log do
20
+ DebugLogging::LogSubscriber.log_event(ActiveSupport::Notifications::Event.new(*subscribe_args))
21
+ end
22
+ end
23
+ end
24
+
25
+ def proxy_ref
26
+ is_class ? "kn" : "inm"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ require_relative "lamb_dart/base"
2
+ require_relative "lamb_dart/log"
3
+ require_relative "lamb_dart/note"
4
+
5
+ module DebugLogging
6
+ module LambDart
7
+ # Namespace
8
+ end
9
+ end
@@ -0,0 +1,41 @@
1
+ require_relative "lamb_darts/benchmarked"
2
+ require_relative "lamb_darts/enter_log"
3
+ require_relative "lamb_darts/error_handle"
4
+ require_relative "lamb_darts/exit_log"
5
+ require_relative "lamb_darts/notify"
6
+
7
+ module DebugLogging
8
+ module LambDartable
9
+ module Log
10
+ class << self
11
+ def included(base)
12
+ base.include(LambDarts::Benchmarked)
13
+ base.include(LambDarts::EnterLog)
14
+ base.include(LambDarts::ErrorHandle)
15
+ base.include(LambDarts::ExitLog)
16
+ end
17
+
18
+ def extended(base)
19
+ base.extend(LambDarts::Benchmarked)
20
+ base.extend(LambDarts::EnterLog)
21
+ base.extend(LambDarts::ErrorHandle)
22
+ base.extend(LambDarts::ExitLog)
23
+ end
24
+ end
25
+ end
26
+
27
+ module Note
28
+ class << self
29
+ def included(base)
30
+ base.include(LambDarts::ErrorHandle)
31
+ base.include(LambDarts::Notify)
32
+ end
33
+
34
+ def extended(base)
35
+ base.extend(LambDarts::ErrorHandle)
36
+ base.extend(LambDarts::Notify)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,19 @@
1
+ module DebugLogging
2
+ module LambDarts
3
+ module Benchmarked
4
+ def _dl_ld_benchmarked(ld)
5
+ brv = nil
6
+ # Benchmarking as close to the real mccoy as possible,
7
+ # so as to not pollute performance tracking with the effects of debug_logging,
8
+ # which may be removed once data has been gathered, or turned off.
9
+ tms = Benchmark.measure do
10
+ brv = yield
11
+ end
12
+ ld.config_proxy.log do
13
+ "#{ld.end_timestamp}#{ld.log_prefix} #{ld.benchmarked(tms)}#{ld.invocation_id}"
14
+ end
15
+ brv
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ module DebugLogging
2
+ module LambDarts
3
+ module EnterLog
4
+ def _dl_ld_enter_log(ld)
5
+ start_timestamp = ld.klass.debug_time_to_s(ld.start_at, config_proxy: ld.config_proxy)
6
+ ld.config_proxy.log do
7
+ paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: ld.instance, payload: ld.method_payload)
8
+ signature = ld.klass.debug_signature_to_s(args: ld.args, kwargs: ld.kwargs, config_proxy: ld.config_proxy)
9
+ paymud = ld.instance.debug_payload_to_s(payload: paydirt, config_proxy: ld.config_proxy)
10
+ "#{start_timestamp}#{ld.log_prefix}#{signature}#{ld.invocation_id} debug: #{paymud}"
11
+ end
12
+ yield
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,28 @@
1
+ module DebugLogging
2
+ module LambDarts
3
+ module ErrorHandle
4
+ def _dl_ld_error_handle(ld)
5
+ if ld.config_proxy.error_handler_proc
6
+ begin
7
+ yield
8
+ rescue StandardError => e
9
+ if ld.error_handler_proc
10
+ ld.error_handler_proc.call(
11
+ ld.config_proxy,
12
+ e,
13
+ self,
14
+ ld.decorated_method,
15
+ *ld.args,
16
+ **ld.kwargs,
17
+ )
18
+ else
19
+ raise e
20
+ end
21
+ end
22
+ else
23
+ yield
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ module DebugLogging
2
+ module LambDarts
3
+ module ExitLog
4
+ def _dl_ld_exit_log(ld)
5
+ hrv = yield
6
+ return hrv unless ld.mark_exit_scope?
7
+
8
+ ld.config_proxy.log do
9
+ "#{ld.end_timestamp}#{ld.log_prefix} completed#{ld.invocation_id}"
10
+ end
11
+ hrv
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ module DebugLogging
2
+ module LambDarts
3
+ module Notify
4
+ def _dl_ld_notify(ld)
5
+ paydirt = DebugLogging::Util.payload_instance_variable_hydration(scope: ld.instance, payload: ld.method_payload)
6
+ ActiveSupport::Notifications.instrument(
7
+ DebugLogging::ArgumentPrinter.debug_event_name_to_s(decorated_method: ld.decorated_method),
8
+ debug_args: ld.debug_args,
9
+ config_proxy: ld.config_proxy,
10
+ **paydirt,
11
+ ) do
12
+ yield
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -32,8 +32,8 @@ module DebugLogging
32
32
  {
33
33
  name: event.name,
34
34
  duration: Rational(event.duration, 1000).to_f,
35
- time: debug_time_to_s(event.time),
36
- end: debug_time_to_s(event.end),
35
+ time: debug_event_time_to_s(event.time),
36
+ end: debug_event_time_to_s(event.end),
37
37
  args: debug_signature_to_s(args: args, config_proxy: config_proxy),
38
38
  payload: debug_payload_to_s(payload: payload, config_proxy: config_proxy),
39
39
  }
@@ -2,6 +2,20 @@ module DebugLogging
2
2
  module Util
3
3
  module_function
4
4
 
5
+ def debug_time(time_or_monotonic)
6
+ case time_or_monotonic
7
+ when Time, DateTime
8
+ time_or_monotonic
9
+ when Numeric
10
+ Time.at(time_or_monotonic)
11
+ when String
12
+ Time.parse(time_or_monotonic)
13
+ else
14
+ # Garbage in, Sweet Nourishing Gruel Out
15
+ Time.now
16
+ end
17
+ end
18
+
5
19
  # methods_to_log may be an array of a single method name, followed by config options and payload,
6
20
  # or it could be an array of method names followed by config options and payload to be shared by the whole set.
7
21
  def extract_payload_and_config(method_names:, payload: nil, config: nil)
@@ -36,6 +50,8 @@ module DebugLogging
36
50
  # logged :meth1, :meth2, :meth3 without options is valid
37
51
  method_names
38
52
  end
53
+ else
54
+ raise ArgumentError, "unknown type for method_names: #{method_names.class}"
39
55
  end
40
56
  [method_names, payload, config_opts]
41
57
  end
@@ -55,27 +71,31 @@ module DebugLogging
55
71
  end
56
72
 
57
73
  def config_proxy_finder(scope:, method_name:, proxy_ref:, config_opts: {}, &block)
58
- if (proxy = scope.send(:instance_variable_get, DebugLogging::Configuration.config_pointer(
59
- proxy_ref,
60
- method_name,
61
- )))
62
- proxy
74
+ proxy = scope.send(
75
+ :instance_variable_get,
76
+ DebugLogging::Configuration.config_pointer(
77
+ proxy_ref,
78
+ method_name,
79
+ ),
80
+ )
81
+ # short circuit on subsequent calls is required
82
+ # so we only register notifications once
83
+ return proxy if proxy
84
+
85
+ base = scope.respond_to?(:debug_config) ? scope.debug_config : DebugLogging.debug_logging_configuration
86
+ proxy = if config_opts.empty?
87
+ base
63
88
  else
64
- base = scope.respond_to?(:debug_config) ? scope.debug_config : DebugLogging.debug_logging_configuration
65
- proxy = if config_opts.empty?
66
- base
67
- else
68
- DebugLogging::Configuration.new(**base.to_hash.merge(config_opts))
69
- end
70
- proxy.register(method_name)
71
- scope.send(
72
- :instance_variable_set,
73
- DebugLogging::Configuration.config_pointer(proxy_ref, method_name),
74
- proxy,
75
- )
76
- yield proxy if block
77
- proxy
89
+ DebugLogging::Configuration.new(**base.to_hash.merge(config_opts))
78
90
  end
91
+ proxy.register(method_name)
92
+ scope.send(
93
+ :instance_variable_set,
94
+ DebugLogging::Configuration.config_pointer(proxy_ref, method_name),
95
+ proxy,
96
+ )
97
+ yield proxy if block
98
+ proxy
79
99
  end
80
100
  end
81
101
  end
@@ -1,5 +1,5 @@
1
1
  module DebugLogging
2
2
  module Version
3
- VERSION = "4.0.0"
3
+ VERSION = "4.0.2"
4
4
  end
5
5
  end
data/lib/debug_logging.rb CHANGED
@@ -15,17 +15,12 @@ require "debug_logging/util"
15
15
  require "debug_logging/finalize"
16
16
  require "debug_logging/argument_printer"
17
17
  require "debug_logging/hooks"
18
+ require "debug_logging/lamb_dart"
19
+ require "debug_logging/lamb_dartable"
18
20
  require "debug_logging/instance_logger_modulizer"
19
21
  require "debug_logging/instance_logger"
20
22
  require "debug_logging/class_logger"
21
23
 
22
- ####################
23
- # #
24
- # NOTE: The manner this is made to work for class methods is totally different
25
- # than the way this is made to work for instance methods.
26
- # NOTE: The instance method manner works on Ruby 2.0+
27
- # NOTE: The class method manner works on Ruby 2.1+
28
- # #
29
24
  ####################
30
25
  # #
31
26
  # USAGE (see specs)#
@@ -233,6 +228,22 @@ module DebugLogging
233
228
  @debug_logging_configuration.colorized_chain_for_class = colorized_chain_for_class
234
229
  end
235
230
 
231
+ def debug_add_timestamp
232
+ @debug_logging_configuration.add_timestamp
233
+ end
234
+
235
+ def debug_add_timestamp=(add_timestamp)
236
+ @debug_logging_configuration.add_timestamp = add_timestamp
237
+ end
238
+
239
+ def debug_time_formatter_proc
240
+ @debug_logging_configuration.time_formatter_proc
241
+ end
242
+
243
+ def debug_time_formatter_proc=(time_formatter_proc)
244
+ @debug_logging_configuration.time_formatter_proc = time_formatter_proc
245
+ end
246
+
236
247
  def debug_add_invocation_id
237
248
  @debug_logging_configuration.add_invocation_id
238
249
  end