Skip to content

Commit c8ad904

Browse files
authored
fix: ZNP ZDO: skip logging payload (#1233)
* fix: ZNP ZDO: skip logging payload * Feedback
1 parent bf3b0a0 commit c8ad904

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/adapter/z-stack/znp/znp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Znp extends events.EventEmitter {
7676
private onUnpiParsed(frame: UnpiFrame): void {
7777
try {
7878
const object = ZpiObject.fromUnpiFrame(frame);
79-
logger.debug(() => `<-- ${object}`, NS);
79+
logger.debug(() => `<-- ${object.toString(object.subsystem !== Subsystem.ZDO)}`, NS);
8080
this.waitress.resolve(object);
8181
this.emit('received', object);
8282
} catch (error) {

src/adapter/z-stack/znp/zpiObject.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ class ZpiObject<T extends ZpiObjectType = 'Response'> {
142142
);
143143
}
144144

145-
public toString(): string {
146-
return `${Type[this.type]}: ${Subsystem[this.subsystem]} - ${this.command.name} - ${JSON.stringify(this.payload)}`;
145+
public toString(includePayload = true): string {
146+
const baseStr = `${Type[this.type]}: ${Subsystem[this.subsystem]} - ${this.command.name}`;
147+
return includePayload ? baseStr + ` - ${JSON.stringify(this.payload)}` : baseStr;
147148
}
148149
}
149150

0 commit comments

Comments
 (0)