Beispiel #1
0
def logFile(message, exception=None, appendLF=True):
    """ Log a message to only the log file (and not the console) """
    prettyEx = prettyException(exception)
    if prettyEx != '':
        message = '%s: %s' % (message, prettyEx)
    if appendLF:
        message = '%s\n' % message
    Hellanzb.logger.log(ScrollableHandler.LOGFILE, message)
Beispiel #2
0
def logFile(message, exception = None, appendLF = True):
    """ Log a message to only the log file (and not the console) """
    prettyEx = prettyException(exception)
    if prettyEx != '':
        message = '%s: %s' % (message, prettyEx)
    if appendLF:
        message = '%s\n' % message
    Hellanzb.logger.log(ScrollableHandler.LOGFILE, message)
Beispiel #3
0
def debug(message, exception=None, appendLF=True):
    """ Log a message at the debug level """
    if Hellanzb.DEBUG_MODE_ENABLED:
        if exception != None:
            prettyEx = prettyException(exception)
            if prettyEx != '':
                message = '%s: %s' % (message, prettyEx)
        if appendLF:
            message = '%s\n' % message
        Hellanzb.logger.debug(message)
Beispiel #4
0
def debug(message, exception = None, appendLF = True):
    """ Log a message at the debug level """
    if Hellanzb.DEBUG_MODE_ENABLED:
        if exception != None:
            prettyEx = prettyException(exception)
            if prettyEx != '':
                message = '%s: %s' % (message, prettyEx)
        if appendLF:
            message = '%s\n' % message
        Hellanzb.logger.debug(message)
Beispiel #5
0
def error(message, exception=None, appendLF=True):
    """ Log a message at the error level. Optionally log exception information """
    prettyEx = prettyException(exception)
    if prettyEx != '':
        message = '%s: %s' % (message, prettyEx)

    try:
        Hellanzb.recentLogs.append(logging.ERROR, message)
    except AttributeError:  # an error occured during startup
        pass

    if appendLF:
        message = '%s\n' % message
    Hellanzb.logger.error(message)
Beispiel #6
0
def error(message, exception = None, appendLF = True):
    """ Log a message at the error level. Optionally log exception information """
    prettyEx = prettyException(exception)
    if prettyEx != '':
        message = '%s: %s' % (message, prettyEx)

    try:
        Hellanzb.recentLogs.append(logging.ERROR, message)
    except AttributeError: # an error occured during startup
        pass
    
    if appendLF:
        message = '%s\n' % message
    Hellanzb.logger.error(message)
Beispiel #7
0
                raise

            return

        except FatalError, fe:
            # REACTOR STOPPED IF NOT BACKGROUND/SUBIDR
            if self.background:
                logStateXML(debug)
            category = self.category
            self.stop()

            # Propagate up to the original Post Processor
            if self.isSubDir:
                raise

            pe = prettyException(fe)
            lines = pe.split('\n')
            archive = archiveName(self.dirName)
            if self.background and Hellanzb.LOG_FILE and len(lines) > 13:
                # Show only the first 4 and last 4 lines of the error
                begin = ''.join([line + '\n' for line in lines[:3]])
                end = ''.join([line + '\n' for line in lines[-9:]])
                msg = begin + \
                    '\n <hellanzb truncated the error\'s output, see the log file for full output>\n' + \
                    end

                noLogFile(archive + ': A problem occurred: ' + msg)
                logFile(archive + ': A problem occurred', fe)
            else:
                error(archive + ': A problem occurred: ' + pe)
Beispiel #8
0
                raise

            return
        
        except FatalError, fe:
            # REACTOR STOPPED IF NOT BACKGROUND/SUBIDR
            if self.background:
                logStateXML(debug)
            category = self.category
            self.stop()

            # Propagate up to the original Post Processor
            if self.isSubDir:
                raise

            pe = prettyException(fe)
            lines = pe.split('\n')
            archive = archiveName(self.dirName)
            if self.background and Hellanzb.LOG_FILE and len(lines) > 13:
                # Show only the first 4 and last 4 lines of the error
                begin = ''.join([line + '\n' for line in lines[:3]])
                end = ''.join([line + '\n' for line in lines[-9:]])
                msg = begin + \
                    '\n <hellanzb truncated the error\'s output, see the log file for full output>\n' + \
                    end
                
                noLogFile(archive + ': A problem occurred: ' + msg)
                logFile(archive + ': A problem occurred', fe)
            else:
                error(archive + ': A problem occurred: ' + pe)