From 49844ab717d8d1790dbdf7f44d160936ece0e80f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 21 Feb 2020 15:59:46 +0100 Subject: Extract client-side logging --- editors/code/src/util.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 editors/code/src/util.ts (limited to 'editors/code/src/util.ts') diff --git a/editors/code/src/util.ts b/editors/code/src/util.ts new file mode 100644 index 000000000..7a6657753 --- /dev/null +++ b/editors/code/src/util.ts @@ -0,0 +1,18 @@ +let enabled: boolean = false; + +export const log = { + debug(message?: any, ...optionalParams: any[]): void { + if (!enabled) return; + // eslint-disable-next-line no-console + console.log(message, ...optionalParams); + }, + error(message?: any, ...optionalParams: any[]): void { + if (!enabled) return; + debugger; + // eslint-disable-next-line no-console + console.error(message, ...optionalParams); + }, + setEnabled(yes: boolean): void { + enabled = yes; + } +}; -- cgit v1.2.3