Skip to content

Commit a026225

Browse files
committed
Improve Listener resource log formatting
1 parent 506748b commit a026225

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/grpc-js-xds/src/xds-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class AdsResponseParser {
250250
if (!decodeResult.value) {
251251
return;
252252
}
253-
this.adsCallState.client.trace('Parsed resource of type ' + this.result.type.getTypeUrl() + ': ' + JSON.stringify(decodeResult.value, undefined, 2));
253+
this.adsCallState.client.trace('Parsed resource of type ' + this.result.type.getTypeUrl() + ': ' + JSON.stringify(decodeResult.value, (key, value) => (value && value.type === 'Buffer' && Array.isArray(value.data)) ? (value.data as Number[]).map(n => n.toString(16)).join('') : value, 2));
254254
this.result.haveValidResources = true;
255255
if (this.result.type.resourcesEqual(resourceState.cachedResource, decodeResult.value)) {
256256
return;

packages/grpc-js-xds/src/xds-resource-type/listener-resource-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class ListenerResourceType extends XdsResourceType {
106106
);
107107
}
108108
const message = decodeSingleResource(LDS_TYPE_URL, resource.value);
109-
trace('Decoded raw resource of type ' + LDS_TYPE_URL + ': ' + JSON.stringify(message, undefined, 2));
109+
trace('Decoded raw resource of type ' + LDS_TYPE_URL + ': ' + JSON.stringify(message, (key, value) => (value && value.type === 'Buffer' && Array.isArray(value.data)) ? (value.data as Number[]).map(n => n.toString(16)).join('') : value, 2));
110110
const validatedMessage = this.validateResource(message);
111111
if (validatedMessage) {
112112
return {

0 commit comments

Comments
 (0)