Module: DevSuite::MethodTracer::Logger

Defined in:
lib/dev_suite/method_tracer/logger.rb

Class Method Summary collapse

Class Method Details

.log_method_call(tp, tracer) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/dev_suite/method_tracer/logger.rb', line 7

def log_method_call(tp, tracer)
  tracer.depth += 1

  # Store the start time for execution time calculation
  tracer.start_times[tp.method_id] = Time.now

  message = build_call_message(tp, tracer)
  Utils::Logger.log(message, emoji: :start, color: :blue)
end

.log_method_return(tp, tracer) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/dev_suite/method_tracer/logger.rb', line 17

def log_method_return(tp, tracer)
  duration = Helpers.calculate_duration(tp, tracer.start_times)

  message = build_return_message(tp, tracer, duration)
  Utils::Logger.log(message, emoji: :finish, color: :cyan)

  # Decrement depth safely
  tracer.depth = [tracer.depth - 1, 0].max
end