def warning(self, logMsg, logType='warn', verbose=True, write=True, logFile=self.logFile): from time import strftime as s, gmtime as g log = "%s %s Warning: %s" % (s(self.strf, g()), self.types[logType], logMsg) if self.verbose and verbose: print log if self.write and write: lf = open(logFile, "a") lf.write(log+"\n") lf.close()
def error(self, logMsg, logType='error', verbose=True, write=True): from time import strftime as s, gmtime as g log = "%s %s Error: %s" % (s(self.strf, g()), self.types[logType], logMsg) if self.verbose and verbose: print log if self.write and write: lf = open(self.logFile, "a") lf.write(log+"\n") lf.close()
def log(self, logMsg, logType='info', write=True): from time import strftime as s, gmtime as g log = "%s %s %s" % (s(self.strf, g()), self.types[logType], logMsg) if self.verbose: print log if self.write: if write: lf = open(self.logFile, "a") lf.write(log + "\n") lf.close()
def logger(logMsg, logType="info", logFile="panda.log", verbose=True, write=False): from time import strftime as s, gmtime as g strf = "[%Y-%M-%d %H:%M%:%S]" logTypes = {"error": "[!]", "info": "[-]", "plus": "[+]"} log = "%s %s %s" % (s(strf, g()), logTypes[logType], logMsg) if verbose: print log if write: lf = open(logFile, "a") lf.write(log + "\n") lf.close()