Module: BiblioTech::Logging

Included in:
Backups::Pruner, CommandGenerator
Defined in:
lib/bibliotech/logger.rb

Defined Under Namespace

Classes: NullLogger

Class Method Summary collapse

Class Method Details

.logObject



26
27
28
# File 'lib/bibliotech/logger.rb', line 26

def log
  return BiblioTech::Logging.logger
end

.log_level(string) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/bibliotech/logger.rb', line 31

def self.log_level(string)
  case string
  when /fatal/i
    Logger::FATAL
  when /error/i
    Logger::ERROR
  when /warn/i
    Logger::WARN
  when /info/i
    Logger::INFO
  when /debug/i
    Logger::DEBUG
  else
    Logger::DEBUG
  end
end

.loggerObject



10
11
12
# File 'lib/bibliotech/logger.rb', line 10

def self.logger
  return (@logger || null_logger)
end

.logger=(value) ⇒ Object



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

def self.logger=(value)
  @logger = value
end

.null_loggerObject



14
15
16
17
18
19
20
# File 'lib/bibliotech/logger.rb', line 14

def self.null_logger
  @null_logger ||=
    begin
      warn "Logging to a NullLogger (because logger didn't get set up)"
      NullLogger.new
    end
end