Sha256: 4fe7922e8c02e5d8f31493ce015b1fad35e3faa160f7fd2c281c736d1d77b145

Contents?: true

Size: 530 Bytes

Versions: 3

Compression:

Stored size: 530 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

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

	private

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

	def debug
		if ENV['DEBUG_SYSLOGSTASH']
			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.2.0 lib/syslogstash/worker.rb
syslogstash-0.1.5 lib/syslogstash/worker.rb
syslogstash-0.1.4 lib/syslogstash/worker.rb