Class: Codebeacon::Tracer::ProgressLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/codebeacon/tracer/src/logger.rb

Constant Summary collapse

PROGRESS_LOG_INTERVAL =
1000

Instance Method Summary collapse

Constructor Details

#initialize(logger, msg, interval = PROGRESS_LOG_INTERVAL) ⇒ ProgressLogger

Returns a new instance of ProgressLogger.



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

def initialize(logger, msg, interval = PROGRESS_LOG_INTERVAL)
  @logger = logger
  @msg = msg
  @interval = interval
  @count = 0
end

Instance Method Details

#finishObject



53
54
55
# File 'lib/codebeacon/tracer/src/logger.rb', line 53

def finish()
  @logger.info("Finished: " + @count.to_s + " " + @msg)
end

#incrementObject



46
47
48
49
50
51
# File 'lib/codebeacon/tracer/src/logger.rb', line 46

def increment()
  @count += 1
  if @count % @interval == 0
    @logger.info(@count.to_s + " " + @msg)
  end
end