No string in slog (#2017)

## Issue Addressed

Following slog's documentation, this should help a bit with string allocations. I left it run for two days and mem usage is lower. This is of course anecdotal, but shouldn't harm anyway 

## Proposed Changes

remove `String` creation in logs when possible
This commit is contained in:
divma
2020-11-30 10:33:00 +00:00
parent 3f036fd193
commit 8fcd22992c
22 changed files with 160 additions and 158 deletions

View File

@@ -206,7 +206,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
// This will subscribe to long-lived random subnets if required.
trace!(self.log,
"Validator subscription";
"subscription" => format!("{:?}", subscription),
"subscription" => ?subscription,
);
self.add_known_validator(subscription.validator_index);
@@ -220,7 +220,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
Err(e) => {
warn!(self.log,
"Failed to compute subnet id for validator subscription";
"error" => format!("{:?}", e),
"error" => ?e,
"validator_index" => subscription.validator_index
);
continue;
@@ -257,7 +257,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
} else {
trace!(self.log,
"Subscribed to subnet for aggregator duties";
"exact_subnet" => format!("{:?}", exact_subnet),
"exact_subnet" => ?exact_subnet,
"validator_index" => subscription.validator_index
);
}
@@ -339,7 +339,7 @@ impl<T: BeaconChainTypes> AttestationService<T> {
// peer before they can be removed.
warn!(self.log,
"Not enough time for a discovery search";
"subnet_id" => format!("{:?}", exact_subnet)
"subnet_id" => ?exact_subnet
);
None
}