Example #1
0
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)
Example #2
0
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)
Example #3
0
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)
Example #4
0
    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
Example #5
0
    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
Example #6
0
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)