main
Alexander Kimmig 2025-10-14 16:44:26 +00:00
parent a5781aa7ab
commit 9a4844e34c
1 changed files with 11 additions and 8 deletions

View File

@ -1,30 +1,33 @@
let _loggerdata = "" let _loggerdata = ""
let _log = true
// define a new console // define a new console
const c=(function(oldCons){ const c=(function(oldCons){
return { return {
log: function(text){ log: function(text){
oldCons.log(text); if (_log) oldCons.log(text)
if (_loggerdata !== "") _loggerdata += "\n" if (_loggerdata !== "") _loggerdata += "\n"
_loggerdata += text _loggerdata += text
}, },
info: function (text) { info: function (text) {
oldCons.info(text); oldCons.info(text)
}, },
warn: function (text) { warn: function (text) {
oldCons.warn(text); oldCons.warn(text)
}, },
error: function (text) { error: function (text) {
oldCons.error(text); oldCons.error(text)
}, },
start: function() { start: function(log) {
_loggerdata = "" _loggerdata = ""
_log = log
}, },
end: function() { end: function() {
_log = true
return _loggerdata return _loggerdata
} }
}; }
}(console)); }(console))
//Then redefine the old console //Then redefine the old console
console = c; console = c