Module: UnitF::Log

Defined in:
lib/unitf/log.rb

Class Method Summary collapse

Class Method Details

.debug(message) ⇒ Object



20
21
22
# File 'lib/unitf/log.rb', line 20

def debug(message)
  logger.debug(message)
end

.error(message) ⇒ Object



32
33
34
# File 'lib/unitf/log.rb', line 32

def error(message)
  logger.error(message)
end

.fatal(message) ⇒ Object



36
37
38
# File 'lib/unitf/log.rb', line 36

def fatal(message)
  logger.fatal(message)
end

.info(message) ⇒ Object



24
25
26
# File 'lib/unitf/log.rb', line 24

def info(message)
  logger.info(message)
end

.loggerObject



6
7
8
# File 'lib/unitf/log.rb', line 6

def logger
  @logger ||= UnitF::Logging::Logger.new
end

.to_consoleObject



10
11
12
# File 'lib/unitf/log.rb', line 10

def to_console
  logger.add_writer(UnitF::Logging::ConsoleWriter.new)
end

.to_file(file, max_files = 3, max_size = 1024000) ⇒ Object



14
15
16
17
18
# File 'lib/unitf/log.rb', line 14

def to_file(file, max_files = 3, max_size = 1024000)
  logger.add_writer(UnitF::Logging::FileWriter.new(file, max_files: max_files, max_size: max_size))
rescue Errno::ENOENT => e
  logger.warn("Unble to create FileWriter for #{file}")
end

.warn(message) ⇒ Object



28
29
30
# File 'lib/unitf/log.rb', line 28

def warn(message)
  logger.warn(message)
end