예제 #1
0
파일: log.py 프로젝트: dgw/goshu
	def log(self, string, indent=0, target='global'):
		""" print/log the given string, with a hanging indent of given spaces."""
		string += self.Fore['RESET'] + self.Style['RESET_ALL']
		print(self.color_string_unescape(strings.wrap(string, indent)))
		
		output = '/{'+str(indent)+'}'+string+'\n'
		
		target_escape = ''
		for character in target:
			if character in valid_characters:
				target_escape += character
			else:
				target_escape += '_'
		path = 'logs/'+target_escape+'.log'
		outfile = open(path, 'a')
		outfile.write(output)
		outfile.close()
예제 #2
0
파일: log.py 프로젝트: DanielOaks/goshu
    def log(self, string, indent=0, target="global"):
        """ print/log the given string, with a hanging indent of given spaces."""
        string += self.Fore["RESET"] + self.Style["RESET_ALL"]
        print(self.color_string_unescape(strings.wrap(string, indent)))

        output = "/{" + str(indent) + "}" + string + "\n"

        target_escape = ""
        for character in target:
            if character in valid_characters:
                target_escape += character
            else:
                target_escape += "_"
        path = "logs/" + target_escape + ".log"
        outfile = open(path, "a")
        outfile.write(output)
        outfile.close()
예제 #3
0
파일: log.py 프로젝트: dgw/goshu
 def print_string(self, string, indent=None):
     """ Prints the given string."""
     if indent == None:
         (indent, string) = self.retrieve_indent(string)
     print(self.color_string_unescape(strings.wrap(string.strip(), indent)))
예제 #4
0
파일: log.py 프로젝트: DanielOaks/goshu
	def print_string(self, string, indent=None):
		""" Prints the given string."""
		if indent == None:
			(indent, string) = self.retrieve_indent(string)
		print(self.color_string_unescape(strings.wrap(string.strip(), indent)))