def filter(self, record):
        """If request_id is set in flask.g, add it to log record."""
        if g and hasattr(g, 'request_id'):
            record.request_id = g.request_id
        return True
def filter ( self , record ) : if g and hasattr ( g , 'request_id' ) : record . request_id = g . request_id return True
If request_id is set in flask.g, add it to log record.