diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-23 10:02:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-23 10:02:08 +0000 |
commit | 58d44c6ba2de32a31a09bbcaf61365a69b69374c (patch) | |
tree | 40f50d70e9ac2bb48d680e4b2fc4a4480eaf4f99 /editors/code/src/util.ts | |
parent | dea1d957e5fec51e8210b3fc4d2db7099d0ff000 (diff) | |
parent | 49844ab717d8d1790dbdf7f44d160936ece0e80f (diff) |
Merge #3261
3261: Extract client-side logging r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/util.ts')
-rw-r--r-- | editors/code/src/util.ts | 18 |
1 files changed, 18 insertions, 0 deletions
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 @@ | |||
1 | let enabled: boolean = false; | ||
2 | |||
3 | export const log = { | ||
4 | debug(message?: any, ...optionalParams: any[]): void { | ||
5 | if (!enabled) return; | ||
6 | // eslint-disable-next-line no-console | ||
7 | console.log(message, ...optionalParams); | ||
8 | }, | ||
9 | error(message?: any, ...optionalParams: any[]): void { | ||
10 | if (!enabled) return; | ||
11 | debugger; | ||
12 | // eslint-disable-next-line no-console | ||
13 | console.error(message, ...optionalParams); | ||
14 | }, | ||
15 | setEnabled(yes: boolean): void { | ||
16 | enabled = yes; | ||
17 | } | ||
18 | }; | ||