Class: Codebeacon::Tracer::ProgressLogger
- Inherits:
-
Object
- Object
- Codebeacon::Tracer::ProgressLogger
- Defined in:
- lib/codebeacon/tracer/src/logger.rb
Constant Summary collapse
- PROGRESS_LOG_INTERVAL =
1000
Instance Method Summary collapse
- #finish ⇒ Object
- #increment ⇒ Object
-
#initialize(logger, msg, interval = PROGRESS_LOG_INTERVAL) ⇒ ProgressLogger
constructor
A new instance of ProgressLogger.
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
#finish ⇒ Object
53 54 55 |
# File 'lib/codebeacon/tracer/src/logger.rb', line 53 def finish() @logger.info("Finished: " + @count.to_s + " " + @msg) end |
#increment ⇒ Object
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 |