Class: ModSpox::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/mod_spox/Logger.rb

Class Method Summary collapse

Class Method Details

.error(s) ⇒ Object



24
25
26
# File 'lib/mod_spox/Logger.rb', line 24

def Logger.error(s)
    @@log.error(s) if Logger.log?
end

.fatal(s) ⇒ Object



20
21
22
# File 'lib/mod_spox/Logger.rb', line 20

def Logger.fatal(s)
    @@log.fatal(s) if Logger.log?
end

.info(s) ⇒ Object



16
17
18
# File 'lib/mod_spox/Logger.rb', line 16

def Logger.info(s)
    @@log.info(s) if Logger.log?
end

.initialize(logger, level) ⇒ Object



6
7
8
9
10
# File 'lib/mod_spox/Logger.rb', line 6

def Logger.initialize(logger, level)
    l = {:info => ::Logger::INFO, :error => ::Logger::ERROR, :warn => ::Logger::WARN, :fatal => ::Logger::FATAL}
    @@log = logger.is_a?(::Logger) ? logger : nil
    @@log.level = l[level]
end

.log?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/mod_spox/Logger.rb', line 28

def Logger.log?
    Logger.class_variable_defined?(:@@log)
end

.rawObject



32
33
34
# File 'lib/mod_spox/Logger.rb', line 32

def Logger.raw
    Logger.log? ? @@log : nil
end

.warn(s) ⇒ Object



12
13
14
# File 'lib/mod_spox/Logger.rb', line 12

def Logger.warn(s)
    @@log.warn(s) if Logger.log?
end