Skip to content

Commit e36e84e

Browse files
chore(analytics): trim key/value before logging (#4628)
1 parent c1f4cac commit e36e84e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/analytics/amplify_analytics_pinpoint_dart/lib/src/impl/analytics_client/endpoint_client/endpoint_global_fields_manager.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,24 @@ class EndpointGlobalFieldsManager {
7676

7777
String _processKey(String key) {
7878
if (key.length > maxKeyLength) {
79+
final trimmedKey = key.substring(0, maxKeyLength);
7980
_logger.warn(
80-
'The key: "$key" ',
81+
'The key beginning with: "$trimmedKey" ',
8182
'has been trimmed to a length of $maxKeyLength characters.',
8283
);
83-
return key.substring(0, maxKeyLength);
84+
return trimmedKey;
8485
}
8586
return key;
8687
}
8788

8889
String _processAttributeValue(String value) {
8990
if (value.length > maxAttributeValueLength) {
91+
final trimmedValue = value.substring(0, maxAttributeValueLength);
9092
_logger.warn(
91-
'The attribute value: "$value" ',
93+
'The attribute value beginning with: "$trimmedValue" ',
9294
'has been trimmed to a length of $maxAttributeValueLength characters.',
9395
);
94-
return value.substring(0, maxAttributeValueLength);
96+
return trimmedValue;
9597
}
9698
return value;
9799
}

0 commit comments

Comments
 (0)