Class: Hotspots::Logger

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

Overview

TODO : Should understand log levels

Defined Under Namespace

Modules: Colour, Sink

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



33
34
35
36
# File 'lib/hotspots/logger.rb', line 33

def initialize
  @sink = Sink::Null
  @colour = Colour::Null
end

Instance Attribute Details

#colourObject (readonly)

Returns the value of attribute colour.



31
32
33
# File 'lib/hotspots/logger.rb', line 31

def colour
  @colour
end

#sinkObject (readonly)

Returns the value of attribute sink.



31
32
33
# File 'lib/hotspots/logger.rb', line 31

def sink
  @sink
end

Instance Method Details

#as_consoleObject



38
39
40
# File 'lib/hotspots/logger.rb', line 38

def as_console
  @sink = Sink::Console
end

#colourizeObject



42
43
44
45
# File 'lib/hotspots/logger.rb', line 42

def colourize
  require 'ansi/code'
  @colour = Colour::ANSI
end

#log(message, options = {}) ⇒ Object



47
48
49
# File 'lib/hotspots/logger.rb', line 47

def log(message, options = {})
  sink << format(message, options)
end