Module: Adhearsion::Logging

Defined in:
lib/adhearsion/logging.rb

Defined Under Namespace

Classes: AdhearsionLogger

Constant Summary collapse

DefaultAdhearsionLogger =
AdhearsionLogger.new 'ahn'
@@logging_level_lock =
Mutex.new

Class Method Summary collapse

Class Method Details

.logging_levelObject



28
29
30
31
32
# File 'lib/adhearsion/logging.rb', line 28

def logging_level
  @@logging_level_lock.synchronize do
    return @@logging_level ||= Log4r::INFO
  end
end

.logging_level=(new_logging_level) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/adhearsion/logging.rb', line 18

def logging_level=(new_logging_level)
  new_logging_level = Log4r.const_get(new_logging_level.to_s.upcase)
  @@logging_level_lock.synchronize do
    @@logging_level = new_logging_level
    Log4r::Logger.each_logger do |logger|
      logger.level = new_logging_level
    end
  end
end

.silence!Object



10
11
12
# File 'lib/adhearsion/logging.rb', line 10

def silence!
  self.logging_level = :fatal
end

.unsilence!Object



14
15
16
# File 'lib/adhearsion/logging.rb', line 14

def unsilence!
  self.logging_level = :info
end