Sha256: 68322c2c2e48467492b47715eb8bb1e12020bb168c44ca92bd9117ed5ebc26c9

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

module RemoteLogger

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

    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

    def self.find(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.5 lib/remote_logger/drb_logger.rb