Skip to content

Commit

Permalink
reduce worker logs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Oct 21, 2021
1 parent 260a239 commit 93cc07c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export interface InitWebWorkerData {
$htmlConstructors$: string[];
$interfaces$: InterfaceInfo[];
$libPath$?: string;
lastLog?: string;
}

export interface InitWebWorkerContext {
Expand Down
13 changes: 8 additions & 5 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ export const logWorker = (msg: string, winId = -1) => {
color = `#9844bf`;
}

console.debug.apply(console, [
`%c${prefix}`,
`background: ${color}; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;`,
msg,
]);
if (webWorkerCtx.lastLog !== msg) {
webWorkerCtx.lastLog = msg;
console.debug.apply(console, [
`%c${prefix}`,
`background: ${color}; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;`,
msg,
]);
}
} catch (e) {}
}
};
Expand Down

1 comment on commit 93cc07c

@vercel
Copy link

@vercel vercel bot commented on 93cc07c Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.