Skip to content

Commit

Permalink
fix: debounce error logging (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulic75 authored May 21, 2022
1 parent f32576a commit de73d05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/logging.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-console */
import { debounce } from "custom-card-helpers";
import { version } from "../package.json";

// Log Version
Expand All @@ -9,10 +10,10 @@ console.groupCollapsed(
console.log("Readme:", "https://github.com/ulic75/power-flow-card");
console.groupEnd();

export function logError(error: string) {
export const logError = debounce((error: string) => {
console.log(
`%c⚡ Power Flow Card v${version} %cError: ${error}`,
"color: #488fc2; font-weight: bold",
"color: #b33a3a; font-weight: normal"
);
}
}, 500);

0 comments on commit de73d05

Please sign in to comment.