Example #1
0
	def debug(self, text, level=DebugLevel.Normal):
		# append to text view
		if self.settings['Debug']['Enabled'] and level >= self.settings['Debug']['Level']:
			self.pop(self.debug_buf)
			position = self.debug_buf.get_end_iter()
			self.debug_buf.insert(position, '[' + tools.get_time() + '] ' + text + '\n')
			logger.debug(text)
Example #2
0
	def log(self, text, type=LogType.Normal):
		# pop first line if we reached the max number of lines
		self.pop(self.log_buf)
		# append to text view
		position = self.log_buf.get_end_iter()
		new_text = '[' + tools.get_time() + '] ' + text + '\n'
		if type == LogType.Success:
			self.log_buf.insert_with_tags(position, new_text, self.green_text_tag)
		elif type == LogType.Error:
			self.log_buf.insert_with_tags(position, new_text, self.red_text_tag)
		elif type == LogType.Info:
			self.log_buf.insert_with_tags(position, new_text, self.blue_text_tag)
		else:
			self.log_buf.insert(position, new_text)
		# call logger
		if type == LogType.Error:
			logger.error(text)
		else:
			logger.new_entry(text)