Skip to content

Commit

Permalink
fix: ZNP ZDO: skip logging payload (#1233)
Browse files Browse the repository at this point in the history
* fix: ZNP ZDO: skip logging payload

* Feedback
  • Loading branch information
Koenkk authored Nov 10, 2024
1 parent bf3b0a0 commit c8ad904
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/adapter/z-stack/znp/znp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Znp extends events.EventEmitter {
private onUnpiParsed(frame: UnpiFrame): void {
try {
const object = ZpiObject.fromUnpiFrame(frame);
logger.debug(() => `<-- ${object}`, NS);
logger.debug(() => `<-- ${object.toString(object.subsystem !== Subsystem.ZDO)}`, NS);
this.waitress.resolve(object);
this.emit('received', object);
} catch (error) {
Expand Down
5 changes: 3 additions & 2 deletions src/adapter/z-stack/znp/zpiObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ class ZpiObject<T extends ZpiObjectType = 'Response'> {
);
}

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

Expand Down

0 comments on commit c8ad904

Please sign in to comment.