def error(errmsg): """ Prints/logs an error message to the server log. errormsg: (string) The message to be logged. """ try: errmsg = to_str(errmsg) except Exception, e: errmsg = str(e)
def info(infomsg): """ Prints any generic debugging/informative info that should appear in the log. infomsg: (string) The message to be logged. """ try: infomsg = to_str(infomsg) except Exception, e: infomsg = str(e)
def warning(warnmsg): """ Prints/logs any warnings that aren't critical but should be noted. warnmsg: (string) The message to be logged. """ try: warnmsg = to_str(warnmsg) except Exception, e: warnmsg = str(e)
def msg(self, message): """ Sends a message to the client. :param str message: The message to send to the client. """ try: message = to_str(message) except Exception, e: self.sendLine(str(e)) return
def trace(errmsg=None): """ Log a traceback to the log. This should be called from within an exception. errmsg is optional and adds an extra line with added info. """ tracestring = format_exc() if tracestring: for line in tracestring.splitlines(): log.msg('[::] %s' % line) if errmsg: try: errmsg = to_str(errmsg) except Exception, e: errmsg = str(e) for line in errmsg.splitlines(): log.msg('[EE] %s' % line)