Squid url redirector

Diff
anonymous

Diff

Differences From Artifact [55bfbe8f1e]:

To Artifact [e86ad177a5]:


105
106
107
108
109
110
111

112





113
114
115
116
117
118
119
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120
121
122
123
124







+
-
+
+
+
+
+







		logging.handlers.SysLogHandler.__init__(self, '/dev/log')
		self._tail = gevent.queue.Queue()
		self._worker = None

	def emit(self, record):
		# my syslog is broken and cannot into UTF-8 BOM
		record.msg = record.msg.encode('utf-8')
		try:
		self._tail.put(record)
			self._tail.put(record)
		except (KeyboardInterrupt, SystemExit):
			raise
		except:
			self.handleError(record)
		if self._worker == None:
			# in case queue is empty we will spawn new worker
			# all workers are logged so we can kill them on close()
			self._worker = gevent.spawn(self._writer)

	def _writer(self):
		# here we are locking the queue so we can be sure we are the only one