Class: Harrods::Logger

Inherits:
Object
  • Object
show all
Extended by:
Presenter
Includes:
Presenter
Defined in:
lib/harrods/logger.rb

Constant Summary

Constants included from Presenter

Presenter::G, Presenter::K, Presenter::M, Presenter::T

Instance Method Summary collapse

Methods included from Presenter

present_storage_size, present_with_commas

Constructor Details

#initialize(colour = :red, destination = $stdout) ⇒ Logger

Returns a new instance of Logger.



8
9
10
11
# File 'lib/harrods/logger.rb', line 8

def initialize(colour=:red, destination=$stdout)
  @logger = destination
  @colour = colour
end

Instance Method Details

#log(ram, objects, gc_runs, gc_time) ⇒ Object



13
14
15
# File 'lib/harrods/logger.rb', line 13

def log(ram, objects, gc_runs, gc_time)
  @logger.write "[HARRODS] RAM: #{present_storage_size(ram)}, OBJECTS: #{present_with_commas(objects)}, GC RUNS: #{gc_runs}, GC TIME: #{gc_time}\n".colorize(@colour)
end