Skip to content

Commit

Permalink
Fixed local logging configuration
Browse files Browse the repository at this point in the history
Also for consistency moved back duration to the root of extra.
  • Loading branch information
ltshb committed Aug 22, 2022
1 parent 7ccff6e commit 8baa2a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ def log_response(response):
"status_code": response.status_code,
"headers": dict(response.headers.items()),
"json": response.json,
"duration": time.time() - g.get('request_started', time.time())
}
},
"duration": time.time() - g.get('request_started', time.time())
}
)
return response
Expand Down
42 changes: 8 additions & 34 deletions logging-cfg-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,43 +70,17 @@ formatters:
excInfo: exc_info
request:
id: flask_request_headers.X-Amz-Cf-Id
path: flask_request_path
method: flask_request_method
queryString: flask_request_query_string
headers:
Content-Type: flask_request_headers.Content-Type
Content-Length: flask_request_headers.Content-Length
Cloudfront-Forwarded-Proto: flask_request_headers.Cloudfront-Forwarded-Proto
Content-Encoding: flask_request_headers.Content-Encoding
Origin: flask_request_headers.Origin
Referer: flask_request_headers.Referer
Accept: flask_request_headers.Accept
Accept-Encoding: flask_request_headers.Accept-Encoding
Accept-Language: flask_request_headers.Accept-Language
User-Agent: flask_request_headers.User-Agent
If-None-Match: flask_request_headers.If-None-Match
Sec-Fetch-Mode: flask_request_headers.Sec-Fetch-Mode
Sec-Fetch-Site: flask_request_headers.Sec-Fetch-Site
Sec-CH-UA: flask_request_headers.Sec-CH-UA
Sec-CH-UA-Mobile: flask_request_headers.Sec-CH-UA-Mobile
Sec-CH-UA-Platform: flask_request_headers.Sec-CH-UA-Platform
Sec-CH-UA-Model: flask_request_headers.Sec-CH-UA-Model
remoteAddr: flask_request_remote_addr
path: "%(flask_request_path)s"
method: "%(flask_request_method)s"
queryString: "%(flask_request_query_string)s"
headers: "%(flask_request_headers)s"
remoteAddr: "%(flask_request_remote_addr)s"
payload: "%(flask_request_json).128s"
response:
statusCode: response.status_code
headers:
Cache-Control: response.headers.Cache-Control
Expires: response.headers.Expires
Content-Type: response.headers.Content-Type
Content-Length: response.headers.Content-Length
Content-Encoding: response.headers.Content-Encoding
Access-Control-Allow-Headers: response.headers.Access-Control-Allow-Headers
Access-Control-Allow-Methods: response.headers.Access-Control-Allow-Methods
Access-Control-Allow-Origin: response.headers.Access-Control-Allow-Origin
ETag: response.headers.ETag
duration: response.duration
payload: "%(response.payload).128s"
headers: response.headers
duration: "%(duration)s"
payload: "%(response.json).128s"
message: message

handlers:
Expand Down

0 comments on commit 8baa2a9

Please sign in to comment.