Module: FreeMessageQueue

Defined in:
lib/fmq/admin.rb,
lib/fmq/boot.rb,
lib/fmq/client.rb,
lib/fmq/server.rb,
lib/fmq/version.rb,
lib/fmq/queues/base.rb,
lib/fmq/queues/file.rb,
lib/fmq/queue_manager.rb,
lib/fmq/queues/linked.rb,
lib/fmq/queues/forward.rb,
lib/fmq/queues/round_robin.rb,
lib/fmq/queues/syncronized.rb,
lib/fmq/queues/load_balanced.rb,
lib/fmq/queues/file_persistent.rb

Overview

Copyright © 2008 Vincent Landgraf

This file is part of the Free Message Queue.

Free Message Queue is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Free Message Queue is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Free Message Queue. If not, see <www.gnu.org/licenses/>.

Defined Under Namespace

Modules: VERSION Classes: AdminInterface, BaseQueue, Boot, ClientQueue, FilePersistentQueue, FileQueue, ForwardQueue, LinkedQueue, LoadBalancedQueue, Message, QueueException, QueueManager, QueueManagerException, RoundRobinQueue, Server, SyncronizedQueue

Constant Summary collapse

SERVER_HEADER =

This is the standard server header that will be used by mongel and other web servers

"FMQ/#{FreeMessageQueue::VERSION::STRING} (#{RUBY_PLATFORM}) Ruby/#{RUBY_VERSION}"

Class Method Summary collapse

Class Method Details

.create_logger(log_to = STDOUT) ⇒ Object

This method creates the logger instance once (even if it is called twice). it is by default on fatal



37
38
39
40
41
# File 'lib/fmq/boot.rb', line 37

def self.create_logger(log_to = STDOUT)
  $FMQ_GLOBAL_LOGGER ||= Logger.new(log_to)
  FreeMessageQueue.log_level(:fatal)
  return $FMQ_GLOBAL_LOGGER
end

.log_level(level) ⇒ Object

This method sets the log level of the fmq logger the level must be a string (either downcase or upcase) that contains one of the following levels:

  • :fatal => Server side errors

  • :error => Server side error backtraces

  • :warn => Client side errors

  • :info => Setup information (config stuff etc.)

  • :debug => All operations of the queue manager and others



51
52
53
54
# File 'lib/fmq/boot.rb', line 51

def self.log_level(level)
  FreeMessageQueue.logger.level = eval("Logger::#{level.to_s.upcase}")
  FreeMessageQueue.logger.debug "[Logger] set log level to #{level}"
end

.loggerObject

This method returns the ruby logger instance for the free message queue, so that it is simple to access the logger from somewhere in the project



31
32
33
# File 'lib/fmq/boot.rb', line 31

def self.logger
  $FMQ_GLOBAL_LOGGER ||= FreeMessageQueue.create_logger
end