diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-19 00:16:51 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-19 00:16:51 +0800 |
commit | 51ae30d794ffd362779b44420c305871d63891ba (patch) | |
tree | 187bc27fb862a037c5388140a5acefce5455d219 /logger.js | |
parent | c87c6f2703d689375518f54905ae10e2edb42d41 (diff) | |
download | SoopyV2-51ae30d794ffd362779b44420c305871d63891ba.tar.gz SoopyV2-51ae30d794ffd362779b44420c305871d63891ba.tar.bz2 SoopyV2-51ae30d794ffd362779b44420c305871d63891ba.zip |
optimisations to threads
Diffstat (limited to 'logger.js')
-rw-r--r-- | logger.js | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -1,10 +1,10 @@ /// <reference types="../CTAutocomplete" /> /// <reference lib="es2015" /> -class Logger{ - constructor(){ +class Logger { + constructor() { this.isDev = isDev() - this.loglevel = this.isDev?4:2 //0=none, 1=error, 2=warn, 3=info, 4=debug + this.loglevel = this.isDev ? 4 : 2 //0=none, 1=error, 2=warn, 3=info, 4=debug this.logToMcChat = false this.logPrefixes = [ "[SOOPYADDONS] ", @@ -16,10 +16,10 @@ class Logger{ this.logMessage("Logger initialised", 3) } - logMessage(message, level){ - if(level <= this.loglevel){ + logMessage(message, level) { + if (level <= this.loglevel) { console.log(this.logPrefixes[level] + message) - if(this.logToMcChat){ + if (this.logToMcChat) { ChatLib.chat(this.logPrefixes[level] + message) } } @@ -27,19 +27,19 @@ class Logger{ } let devs = ["dc8c39647b294e03ae9ed13ebd65dd29"] -function isDev(){ +function isDev() { return devs.includes(Player.getUUID().toString().replace(/-/g, "")) } -if(!global.soopyv2loggerthing){ +if (!global.soopyv2loggerthing) { global.soopyv2loggerthing = new Logger() - register("command", ()=>{ + register("command", () => { devs.push(Player.getUUID().toString().replace(/-/g, "")) }).setName("pleasegivemeaccesstosoopyv2devconsolelogs") //yep - register("gameUnload", ()=>{ + register("gameUnload", () => { global.soopyv2loggerthing = undefined }) } |