Module: Ligo::Logging

Included in:
Accessory, Device
Defined in:
lib/ligo/logging.rb

Overview

Logging module

This module enables to share the same logger between all the Ligo classes.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure_logger_for(classname) ⇒ Object



40
41
42
43
44
# File 'lib/ligo/logging.rb', line 40

def configure_logger_for(classname)
  logger = Logger.new(@out)
  logger.progname = classname
  logger
end

.configure_logger_output(logout) ⇒ Object



47
48
49
# File 'lib/ligo/logging.rb', line 47

def configure_logger_output(logout)
  @out = logout if logout != 'STDOUT'
end

.logger_for(classname) ⇒ Object



36
37
38
# File 'lib/ligo/logging.rb', line 36

def logger_for(classname)
  @loggers[classname] ||= configure_logger_for(classname)
end

Instance Method Details

#loggerObject



27
28
29
# File 'lib/ligo/logging.rb', line 27

def logger
  @logger ||= Logging.logger_for(self.class.name)
end