Sure you can! Keep in mind that the colorless final version of the log_request is this one:
@app.after_requestdeflog_request(response):"Log HTTP request details"if(request.path=="/favicon.ico"orrequest.path.startswith("/static")orrequest.path.startswith("/admin/static")):returnresponsenow=time.time()duration=round(now-g.start,6)# to the microsecond
ip_address=request.headers.get("X-Forwarded-For",request.remote_addr)host=request.host.split(":",1)[0]params=dict(request.args)request_id=request.headers.get("X-Request-ID","")log_params={"method":request.method,"path":request.path,"status":response.status_code,"duration":duration,"ip":ip_address,"host":host,"params":params,"request_id":request_id,}log.info("request",**log_params)returnresponse
Sure you can! Keep in mind that the colorless final version of the
log_request
is this one:Many thanks