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()
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()
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)))