From 9a4844e34cf5af332ca769c97997ebbe998e9ad2 Mon Sep 17 00:00:00 2001 From: Alexander Kimmig Date: Tue, 14 Oct 2025 16:44:26 +0000 Subject: [PATCH] logger --- logger.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/logger.ts b/logger.ts index 32ee9b3..153ee96 100644 --- a/logger.ts +++ b/logger.ts @@ -1,30 +1,33 @@ let _loggerdata = "" +let _log = true // define a new console const c=(function(oldCons){ return { log: function(text){ - oldCons.log(text); + if (_log) oldCons.log(text) if (_loggerdata !== "") _loggerdata += "\n" _loggerdata += text }, info: function (text) { - oldCons.info(text); + oldCons.info(text) }, warn: function (text) { - oldCons.warn(text); + oldCons.warn(text) }, error: function (text) { - oldCons.error(text); + oldCons.error(text) }, - start: function() { + start: function(log) { _loggerdata = "" + _log = log }, end: function() { + _log = true return _loggerdata } - }; -}(console)); + } +}(console)) //Then redefine the old console -console = c; \ No newline at end of file +console = c \ No newline at end of file