Module: PikaQue::Logging

Included in:
Connection, Launcher, Processor, Subscriber
Defined in:
lib/pika_que/logging.rb

Defined Under Namespace

Classes: PikaQueFormatter

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.init_logger(stream = STDOUT) ⇒ Object



13
14
15
16
17
18
# File 'lib/pika_que/logging.rb', line 13

def self.init_logger(stream = STDOUT)
  @logger = Logger.new(stream, 5, 1048576).tap do |l|
    l.level = Logger::INFO
    l.formatter = PikaQueFormatter.new
  end
end

.loggerObject



20
21
22
# File 'lib/pika_que/logging.rb', line 20

def self.logger
  @logger || init_logger
end

.logger=(logger) ⇒ Object



24
25
26
# File 'lib/pika_que/logging.rb', line 24

def self.logger=(logger)
  @logger = logger ? logger : Logger.new(File::NULL)
end

Instance Method Details

#loggerObject



28
29
30
# File 'lib/pika_que/logging.rb', line 28

def logger
  PikaQue::Logging.logger
end