Conversation
|
Thanks for working on this. I wanted to do it since a while 😅 Early feedback... The way I was planning to handle this was to have a base module to collect any kind of "request/response log". Would you consider splitting this part to a module like |
|
@simahawk for now I don't want to overengineer this module. But feel free to split it when done. As a side note about that, is there any advantage to have all heterogeneous logs in the same model/views? Because aside of that, the amount of factored code would be low. |
|
Hi @paradoxxxzero, thanks for this PR! |
|
Hello, no we have it deployed, I just forgot to remove the draft status, thanks. |
| fastapi_endpoint = ( | ||
| self.request.env["fastapi.endpoint"] | ||
| .sudo() | ||
| .search([("root_path", "=", root_path)]) | ||
| ) |
There was a problem hiding this comment.
question: what do you think about calling the get_uid method of fastapi.endpoint?
This way, if we need to override the method, the same endpoint will be matched
There was a problem hiding this comment.
get_uid would return the user ID, could you please clarify how that could be used in this piece of code?
In akretion#8 I have included your PR #515 and used the new get_endpoint, is that what you meant?
There was a problem hiding this comment.
Yeah that's what I meant. Sorry for the confusion.
|
|
||
| def _headers_to_dict(self, headers): | ||
| try: | ||
| return {key.lower(): value for key, value in headers.items()} |
There was a problem hiding this comment.
issue: we should redact sentitive headers
rest-framework/rest_log/components/service.py
Lines 130 to 132 in e0e48e3
rest-framework/base_rest/http.py
Lines 109 to 111 in e0e48e3
There was a problem hiding this comment.
Right, added this too in akretion#8.
| finally: | ||
| if not tools.config["test_enable"]: | ||
| try: | ||
| cr.commit() # pylint: disable=E8102 |
There was a problem hiding this comment.
Do you want to rollback the all the process if you encounter an error only with the cursor used for logging?
|
Hello @paradoxxxzero Thank you! |
cac2381 to
16fa971
Compare
|
Superseeded by #554 |
This is not a migration of rest_log, this module aims to be simpler, at least in the first iterations.
This PR depends on #500