Пример #1
0
    def __init__(self, app, config=None, framework_config=None):
        """Initialize the RequestStats Middleware
        Every single request will get logged with a unix timestamp
        the time it took to respond and the url that was requested.
        The dictionary is passed on the RequestParser that deals
        with building the cache and submitting the data to 
        the queue.
        """
        self.app = app

        self.config = options(config, framework_config)
        self.parser = RequestParser(self.config)

        setlogging(self.config)
        log.middleware.debug('middleware Initialized')
Пример #2
0
from bottle import response, request, redirect, route, run, view, send_file, local, TEMPLATE_PATH
from waskr import log
from waskr.config import options, setlogging
from waskr.database import Stats

# Fixes a call from a different path
CWD = path.abspath(__file__)
APP_CWD = path.dirname(CWD)
view_dir = APP_CWD + '/views'
TEMPLATE_PATH.append(view_dir)

# Initialize the CONF with proper values
CONF = options()

# Initialize logging
setlogging(CONF)
log.server.debug("initialized logging")


@route('/')
@view('index')
def index():
    logged_in()
    return dict(last_received=local.db.last_insert(),
                apps=local.db.apps_nodes())


@route('/application/:name/:type')
@route('/application/:name/:type/:minutes')
@view('stats')
def interacting(name, type, minutes=2):
Пример #3
0
from bottle import response, request, redirect, route, run, view, send_file, local, TEMPLATE_PATH 
from waskr import log
from waskr.config import options, setlogging
from waskr.database import Stats

# Fixes a call from a different path
CWD = path.abspath(__file__)
APP_CWD = path.dirname(CWD)
view_dir = APP_CWD+'/views'
TEMPLATE_PATH.append(view_dir)

# Initialize the CONF with proper values
CONF = options()

# Initialize logging
setlogging(CONF)
log.server.debug("initialized logging")


@route('/')
@view('index')
def index():
    logged_in()
    return dict(last_received=local.db.last_insert(),
                apps=local.db.apps_nodes())


@route('/application/:name/:type')
@route('/application/:name/:type/:minutes')
@view('stats')
def interacting(name, type, minutes=2):