Class: RemoteLogger::DrbLogger

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

Overview

Subclass of RemoteLogger::Logger communicating via DRb protocol

Class Method Summary collapse

Methods inherited from Logger

#initialize

Constructor Details

This class inherits a constructor from RemoteLogger::Logger

Class Method Details

.find(options = {}) ⇒ Object



26
27
28
29
30
31
# File 'lib/remote_logger/drb_logger.rb', line 26

def self.find(options = {})
  DRb.start_service

  # Connecting to Logger
  DRbObject.new_with_uri(options[:uri]||DRB_URI)
end

.start(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/remote_logger/drb_logger.rb', line 6

def self.start(options = {})
  # Adding some security (disable remote eval)
  $SAFE = 1

  name = options[:name] || LOGGER_NAME

  # Creating logger instance
  logger = new options

  # Raising new RingyDingy service
  logger.info "#{name}: Initializing service..." if options[:verbose]
  DRb.start_service(options[:uri]||DRB_URI, logger)
  logger.info "#{name}: Service started" if options[:verbose]

  DRb.thread.join

  # Never reaches this point...
  logger.info "#{name}: Service finished" if options[:verbose]
end