Source code for fplaneserver.flask.before_after

"""
This module contain all the code that need to execute before and after every
request
"""
import logging

from flask import request, g


########################################
# before requests

[docs]def before(): """ before request function. Setup the logger """ # create the extra dictionary for the logger and put it into the g object # to be accessible everywhere g.extra = {"request": request.method, "path": request.path, "ip": request.remote_addr} g.logger = logging.getLogger('default')