Class: CodeQualia::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/code_qualia/logger.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.verboseObject

Returns the value of attribute verbose.



6
7
8
# File 'lib/code_qualia/logger.rb', line 6

def verbose
  @verbose
end

Class Method Details

.log(message) ⇒ Object



8
9
10
11
12
13
# File 'lib/code_qualia/logger.rb', line 8

def log(message)
  return unless verbose

  timestamp = Time.now.strftime('%H:%M:%S')
  $stderr.puts "[#{timestamp}] #{message}"
end

.log_error(step_name, error) ⇒ Object



32
33
34
35
36
37
# File 'lib/code_qualia/logger.rb', line 32

def log_error(step_name, error)
  return unless verbose

  timestamp = Time.now.strftime('%H:%M:%S')
  $stderr.puts "[#{timestamp}] ❌ #{step_name} failed: #{error.message}"
end

.log_result(step_name, result_count = nil, duration = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/code_qualia/logger.rb', line 22

def log_result(step_name, result_count = nil, duration = nil)
  return unless verbose

  timestamp = Time.now.strftime('%H:%M:%S')
  message = "[#{timestamp}] ✅ #{step_name} completed"
  message += " (#{result_count} items)" if result_count
  message += " in #{duration.round(2)}s" if duration
  $stderr.puts message
end

.log_skip(step_name, reason) ⇒ Object



39
40
41
42
43
44
# File 'lib/code_qualia/logger.rb', line 39

def log_skip(step_name, reason)
  return unless verbose

  timestamp = Time.now.strftime('%H:%M:%S')
  $stderr.puts "[#{timestamp}] ⏭️  Skipping #{step_name}: #{reason}"
end

.log_step(step_name) ⇒ Object



15
16
17
18
19
20
# File 'lib/code_qualia/logger.rb', line 15

def log_step(step_name)
  return unless verbose

  timestamp = Time.now.strftime('%H:%M:%S')
  $stderr.puts "[#{timestamp}] 🔍 Starting #{step_name}..."
end