Пример #1
0
def filter_logs():
    print(Log.serialize())
    logs = [log for log in Log.serialize() if all(
        # if the node-regex property is not in the request, the
        # regex box is unticked and we only check that the values
        # are equal.
        str(val) == request.form[prop] if not prop + 'regex' in request.form
        # if it is ticked, we use re.search to check that the value
        # of the node property matches the regular expression,
        # providing that the property field in the form is not empty
        # (empty field <==> property ignored)
        else search(request.form[prop], str(val)) for prop, val in log.items()
        if prop in request.form and request.form[prop]
    )]
    return jsonify(logs)
Пример #2
0
def log_management():
    log_filtering_form = LogFilteringForm(request.form)
    return render_template('log_management.html',
                           log_filtering_form=log_filtering_form,
                           names=pretty_names,
                           fields=('source', 'content'),
                           logs=Log.serialize())
Пример #3
0
 def handle(self):
     with scheduler.app.app_context():
         data = bytes.decode(self.request[0].strip())
         source, _ = self.client_address
         log = Log(source, str(data))
         db.session.add(log)
         db.session.commit()
Пример #4
0
def logs():
    form = LogFilteringForm(request.form)
    return render_template(
        'logs_overview.html',
        form=form,
        names=pretty_names,
        fields=('source', 'content'),
        logs=Log.serialize(),
    )