예제 #1
0
    def text(self, errno, errorname, *args):
        """ Write errorname and a line numbered version of args[0] %
            args[1:] to the log file.

            This method is meant for multi line error messages that
            hold additional data referring to the error.

            Needs mx.TextTools to be installed.
            
        """
        if errno >= self.ignore_level: return
        if len(args) > 1:
            s = args[0] % args[1:]
        elif len(args) == 1:
            s = args[0]
        else:
            s = ''
        from mx.TextTools import splitlines
        l = splitlines(s)
        for i in range(len(l)):
            l[i] = '%04i %s' % (i + 1, l[i])
        f = self.open_log_file or self.open()
        f.write("%04i %s [%s] %s\n" %
                (errno, _DateTime.now(), self.log_id, errorname))
        f.write(79 * '-' + '\n%s\n' % '\n'.join(l) + 79 * '-' + '\n')
        f.flush()
예제 #2
0
    def text(self,errno,errorname,*args):

        """ Write errorname and a line numbered version of args[0] %
            args[1:] to the log file.

            This method is meant for multi line error messages that
            hold additional data referring to the error.

            Needs mx.TextTools to be installed.
            
        """
        if errno >= self.ignore_level: return
        if len(args) > 1:
            s = args[0] % args[1:]
        elif len(args) == 1:
            s = args[0]
        else:
            s = ''
        from mx.TextTools import splitlines
        l = splitlines(s)
        for i in range(len(l)):
            l[i] = '%04i %s' % (i+1,l[i])
        f = self.open_log_file or self.open()
        f.write("%04i %s [%s] %s\n" %
                (errno,_DateTime.now(),self.log_id, errorname))
        f.write(79*'-'+ '\n%s\n' % '\n'.join(l) + 79*'-'+'\n')
        f.flush()