Class: RSpecTracer::Logger Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Internal Logger — see RSpecTracer for the user-facing surface. Internal logger; thin wrapper around ‘puts` gated on numeric log level. Exposed via `RSpecTracer.logger`.

Instance Method Summary collapse

Constructor Details

#initialize(log_level) ⇒ Logger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



12
13
14
# File 'lib/rspec_tracer/logger.rb', line 12

def initialize(log_level)
  @log_level = log_level
end

Instance Method Details

#debug(message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



18
19
20
# File 'lib/rspec_tracer/logger.rb', line 18

def debug(message)
  puts message if @log_level == 1
end

#error(message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



36
37
38
# File 'lib/rspec_tracer/logger.rb', line 36

def error(message)
  puts message if @log_level.between?(1, 4)
end

#info(message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



24
25
26
# File 'lib/rspec_tracer/logger.rb', line 24

def info(message)
  puts message if @log_level.between?(1, 2)
end

#warn(message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Internal method on the tracer pipeline.



30
31
32
# File 'lib/rspec_tracer/logger.rb', line 30

def warn(message)
  puts message if @log_level.between?(1, 3)
end