Sha256: b6dd7b9b6e8d82f99f1f412e4aa44c6bc9cb2e7e11d38e087e73092b527cd2b7

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

module RemoteLogger

  # Subclass of RemoteLogger::Logger communicating via DRb protocol
  class DrbLogger < RemoteLogger::Logger

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

      # 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

    def self.find(name = LOGGER_NAME, options = {})
      DRb.start_service
      # Connecting to Logger
      DRbObject.new_with_uri(options[:uri]||DRB_URI)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remote_logger-0.0.4 lib/remote_logger/drb_logger.rb