<commit_before># Copyright (c) 2005-2007 rPath, Inc
# All rights reserved

from raa.modules.raawebplugin import rAAWebPlugin
import turbogears
import os
from os import path
import re
import cherrypy

class RBALog(rAAWebPlugin):
    '''
        Display jobserver log
    '''
    displayName = _("View rBuilder Log")

    logPath = 'srv/rbuilder/logs/job-server.log'
    jsrvPath = '/srv/rbuilder/jobserver/'

    @turbogears.expose(html="rPath.rbalog.log")
    @turbogears.identity.require(turbogears.identity.not_anonymous())
    def index(self):
        return dict(logText=self.getLog())

    @turbogears.expose()
    @turbogears.identity.require(turbogears.identity.not_anonymous())
    def rBuilderLog(self):
        cherrypy.response.headerMap['Content-Type'] = 'text/plain'
        return self.getLog()

    def getLog(self):
        try:
            dirs = os.listdir(self.jsrvPath)
            jsdir = [x for x in dirs if re.match('^\d+\.\d+\.\d+$', x)][0]
            fullPath = path.join(self.jsrvPath, jsdir, self.logPath)
            f = open(fullPath)
            logText = f.read()
            f.close()
        except (IOError, AttributeError, IndexError, OSError):
            logText = 'Error:  Log file not found' 
        return logText<commit_msg>retitle rbalog plugin<commit_after># Copyright (c) 2005-2007 rPath, Inc
# All rights reserved

from raa.modules.raawebplugin import rAAWebPlugin
import turbogears
import os
from os import path
import re
import cherrypy

class RBALog(rAAWebPlugin):
    '''
        Display jobserver log
    '''
    displayName = _("Job Server Log")

    logPath = 'srv/rbuilder/logs/job-server.log'
    jsrvPath = '/srv/rbuilder/jobserver/'

    @turbogears.expose(html="rPath.rbalog.log")
    @turbogears.identity.require(turbogears.identity.not_anonymous())
    def index(self):
        return dict(logText=self.getLog())

    @turbogears.expose()
    @turbogears.identity.require(turbogears.identity.not_anonymous())
    def rBuilderLog(self):
        cherrypy.response.headerMap['Content-Type'] = 'text/plain'
        return self.getLog()

    def getLog(self):
        try:
            dirs = os.listdir(self.jsrvPath)
            jsdir = [x for x in dirs if re.match('^\d+\.\d+\.\d+$', x)][0]
            fullPath = path.join(self.jsrvPath, jsdir, self.logPath)
            f = open(fullPath)
            logText = f.read()
            f.close()
        except (IOError, AttributeError, IndexError, OSError):
            logText = 'Error:  Log file not found' 
        return logText
{'fraction_non_alphanumeric': 0.12367073651043718, 'fraction_numerical': 0.0070894052776683735, 'mean_word_length': 2.708029197080292, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6703612', 'n_tokens_mistral': 869, 'n_tokens_neox': 836, 'n_words': 177}