Overall code improvements #1118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a bit of everything, but the overall goal is to make the code a little more readable and efficient 😄
It essentially does three things:
Adds the crates
tracing
andtracing-log
: this enables us to replace all the manual logs we have in our methods with the#[tracing::instrument]
macro, which will log the name of the function and the parameters it was called with. This makes the code much easier to read and uniform, and also makes the logs easier to read, as the function name and arguments are now logged on the same line and we get basically one line per function call.Removes unnecessary logs: now that we have the above we no longer need to log all the messages we receive and send to the server, as we're already logging the parameters with which we call the functions anyways, so this will make the logs a lot easier to read as well.
Removes unnecessary clones: We had a lot of cases where we called
serde_json::from_value(value.clone())
when really we could be callingT::deserialize(&value)
, which doesn't take ownership ofvalue
and achieves exactly the same.