Class: Top4R::Logger

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

Defined Under Namespace

Classes: Nogger

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, is_trace = false) ⇒ Logger

Returns a new instance of Logger.



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

def initialize(logger, is_trace = false)
  @trace = is_trace
  @logger = logger || Nogger.new
end

Instance Attribute Details

#traceObject

Returns the value of attribute trace.



3
4
5
# File 'lib/top4r/logger.rb', line 3

def trace
  @trace
end

Class Method Details

.set_logger(logger) ⇒ Object



6
7
8
# File 'lib/top4r/logger.rb', line 6

def set_logger(logger)
  self.new logger
end

Instance Method Details

#info(log) ⇒ Object



22
23
24
# File 'lib/top4r/logger.rb', line 22

def info(log)
  @logger.info "top4r trace: #{log}" if @trace
end