Skip to content

Commit

Permalink
chore(analytics): trim key/value before logging (#4628)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan-Nelson committed Apr 2, 2024
1 parent c1f4cac commit e36e84e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,24 @@ class EndpointGlobalFieldsManager {

String _processKey(String key) {
if (key.length > maxKeyLength) {
final trimmedKey = key.substring(0, maxKeyLength);
_logger.warn(
'The key: "$key" ',
'The key beginning with: "$trimmedKey" ',
'has been trimmed to a length of $maxKeyLength characters.',
);
return key.substring(0, maxKeyLength);
return trimmedKey;
}
return key;
}

String _processAttributeValue(String value) {
if (value.length > maxAttributeValueLength) {
final trimmedValue = value.substring(0, maxAttributeValueLength);
_logger.warn(
'The attribute value: "$value" ',
'The attribute value beginning with: "$trimmedValue" ',
'has been trimmed to a length of $maxAttributeValueLength characters.',
);
return value.substring(0, maxAttributeValueLength);
return trimmedValue;
}
return value;
}
Expand Down

0 comments on commit e36e84e

Please sign in to comment.