diff options
Diffstat (limited to 'src/utils/logger.ts')
-rw-r--r-- | src/utils/logger.ts | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 2d3a1b92..76a5fb6b 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,12 +1,18 @@ -window["SBLogs"] = { - debug: [], - warn: [] -}; +if (typeof (window) !== "undefined") { + window["SBLogs"] = { + debug: [], + warn: [] + }; +} export function logDebug(message: string) { - window["SBLogs"].debug.push(`[${new Date().toISOString()}] ${message}`); + if (typeof (window) !== "undefined") { + window["SBLogs"].debug.push(`[${new Date().toISOString()}] ${message}`); + } } export function logWarn(message: string) { - window["SBLogs"].warn.push(`[${new Date().toISOString()}] ${message}`); + if (typeof (window) !== "undefined") { + window["SBLogs"].warn.push(`[${new Date().toISOString()}] ${message}`); + } }
\ No newline at end of file |