Sha256: 4a5ebafa30031a82ac063558df2b44e7dc39506233cd3b4ccc29080580013b3b

Contents?: true

Size: 574 Bytes

Versions: 3

Compression:

Stored size: 574 Bytes

Contents

# Common code shared between both readers and writers.
#
module Syslogstash::Worker
	# If you ever want to stop a reader, here's how.
	def stop
		if @worker
			@worker.kill
			@worker.join
			@worker = nil
		end
	end

	def thread
		@worker
	end

	# If you want to wait for a reader to die, here's how.
	#
	def wait
		@worker.join
	end

	private

	def log
		$stderr.puts "#{Time.now.strftime("%F %T.%L")} #{self.class} #{yield.to_s}"
	end

	def debug
		if ENV['DEBUG_SYSLOGSTASH']
			$stderr.puts "#{Time.now.strftime("%F %T.%L")} #{self.class} #{yield.to_s}"
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
syslogstash-0.4.1 lib/syslogstash/worker.rb
syslogstash-0.4.0 lib/syslogstash/worker.rb
syslogstash-0.3.0 lib/syslogstash/worker.rb