Class: Henry::LoggerService
- Inherits:
-
Object
- Object
- Henry::LoggerService
- Defined in:
- lib/henry/logger_service.rb
Constant Summary collapse
- DRB_URI =
Uri where the service will be listening.
'druby://localhost'
- DRB_PORTS =
Range of ports to be used.
(8787..8800)
Class Method Summary collapse
-
.start(logger) ⇒ Object
Starts the logger service sharing the given Logger.
-
.stop ⇒ Object
Stops the logger service.
Class Method Details
.start(logger) ⇒ Object
Starts the logger service sharing the given Logger.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/henry/logger_service.rb', line 14 def self.start(logger) 10.times do begin drb_uri = "#{DRB_URI}:#{rand(DRB_PORTS)}" DRb.start_service(drb_uri, logger) ENV['DRB_LOGGER_URI'] = drb_uri rescue Errno::EADDRINUSE end end return false end |
.stop ⇒ Object
Stops the logger service.
28 29 30 31 32 |
# File 'lib/henry/logger_service.rb', line 28 def self.stop DRb.stop_service rescue return false end |