Make debug logging controllable by config.

This commit is contained in:
Dermot Duffy
2023-01-29 15:56:47 -08:00
parent 0caf64ba82
commit 49e5cc5c5e
8 changed files with 74 additions and 31 deletions
-8
View File
@@ -166,14 +166,6 @@ export function getDurationString(start: Date, end: Date): string {
return duration;
}
/**
* For debug purposes only.
* @param seconds
*/
export const sleep = async (seconds: number) => {
await new Promise((r) => setTimeout(r, seconds * 1000));
};
export const allPromises = async <T>(
items: T[],
func: (arg: T) => void,
+15
View File
@@ -0,0 +1,15 @@
import { CardWideConfig } from '../types';
export const log = (cardWideConfig?: CardWideConfig, ...args: unknown[]) => {
if (cardWideConfig?.debug?.logging) {
console.debug(...args);
}
};
/**
* For debug purposes only.
* @param seconds
*/
export const sleep = async (seconds: number) => {
await new Promise((r) => setTimeout(r, seconds * 1000));
};