Add:Env variable setting to allow CORS

This commit is contained in:
advplyr 2024-05-19 14:40:46 -05:00
parent ab2026ecea
commit 69833db819
3 changed files with 9 additions and 7 deletions

View file

@ -7,6 +7,7 @@ class Logger {
this.logManager = null
this.isDev = process.env.NODE_ENV !== 'production'
this.logLevel = !this.isDev ? LogLevel.INFO : LogLevel.TRACE
this.socketListeners = []
}
@ -49,7 +50,7 @@ class Logger {
}
addSocketListener(socket, level) {
var index = this.socketListeners.findIndex(s => s.id === socket.id)
var index = this.socketListeners.findIndex((s) => s.id === socket.id)
if (index >= 0) {
this.socketListeners.splice(index, 1, {
id: socket.id,
@ -66,7 +67,7 @@ class Logger {
}
removeSocketListener(socketId) {
this.socketListeners = this.socketListeners.filter(s => s.id !== socketId)
this.socketListeners = this.socketListeners.filter((s) => s.id !== socketId)
}
/**
@ -135,8 +136,8 @@ class Logger {
/**
* Fatal errors are ones that exit the process
* Fatal logs are saved to crash_logs.txt
*
* @param {...any} args
*
* @param {...any} args
*/
fatal(...args) {
console.error(`[${this.timestamp}] FATAL:`, ...args, `(${this.source})`)
@ -148,4 +149,4 @@ class Logger {
this.handleLog(LogLevel.NOTE, args, this.source)
}
}
module.exports = new Logger()
module.exports = new Logger()