async-graphql / examples

217 stars 54 forks source link

Create an actix-web example of logging a query. #19

Closed MidasLamb closed 4 years ago

MidasLamb commented 4 years ago

Added an example in the actix-web examples to demonstrate how to log an entire query, in case an error is returned.

sunli829 commented 4 years ago

Why don't you use the extensions ::Logger? 🙂

MidasLamb commented 4 years ago

As far as I could tell, it doesn't log the entire query, it only logs the path and the error itself, but e.g. input parameters and such are gone. I also didn't find a way to modify the extension to log the entire query as the Trait doesn't allow the error method access to the query source

sunli829 commented 4 years ago

Thank you for your contribution to this project, but I think the problem is due to an imperfect Logger extension, so I updated it and now also provide a query source when an error occurs. It's is released on v1.15.8. 😀

MidasLamb commented 4 years ago

Wow, that's great! I took a quick look and I thought it wouldn't be straightforward to do in the logger, but I love that you guys just immediatly take an opportunity to improve the project without much hassle or anything. Keep up the good work!

sunli829 commented 4 years ago

If there are any desired improvements, please feel free to let us know. 😄