def __init__(self, typ, string): # creating the class variables self.type = typ self.string = string self.message = "" # creating the message string with the colors and symbols according if typ == "warning": self.message = colors.yellow("[!] " + str(self.string)) elif typ == "error": self.message = colors.red("[!] " + str(self.string)) elif typ == "process": self.message = colors.white("[*] " + str(self.string)) elif typ == "result": self.message = colors.green("[+] " + str(self.string)) elif typ == "output": self.message = colors.white(str(self.string))
def __init__(self, string): self.type = "" self.string = string.replace("\\r\\n", "\n") self.message = "" # creating the message string with the colors and symbols according if self.string[0:3] == "[!]": self.message = colors.red(str(self.string)) self.type = "error" elif self.string[0:3] == "[*]": self.message = colors.white(str(self.string)) self.type = "process" elif self.string[0:3] == "[+]": self.message = colors.green(str(self.string)) self.type = "result"