class Synco::LogPipe
Public Class Methods
new(logger, level = :info)
click to toggle source
Calls superclass method
# File lib/synco/scope.rb, line 149 def initialize(logger, level = :info) @input, @output = IO.pipe @logger = logger super(@output) @thread = Thread.new do @input.each{|line| logger.send(level, line.chomp!)} end end
Public Instance Methods
close()
click to toggle source
# File lib/synco/scope.rb, line 160 def close # Close the output pipe, we should never be writing to this anyway: @output.close # Wait for the thread to read everything and join: @thread.join # Close the input pipe because it's already closed on the remote end: @input.close end