Example #1
0
File: log.py Project: 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()
Example #2
0
    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()
Example #3
0
File: log.py Project: 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)))
Example #4
0
	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)))