From df6505de3cde6bc36b0bdc38d626a1edbdb8cf88 Mon Sep 17 00:00:00 2001 From: Alexander Kimmig Date: Mon, 13 Oct 2025 16:51:43 +0000 Subject: [PATCH] logger --- logger.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 logger.ts diff --git a/logger.ts b/logger.ts new file mode 100644 index 0000000..15ae461 --- /dev/null +++ b/logger.ts @@ -0,0 +1,29 @@ +let _loggerdata = "" + +// define a new console +const c=(function(oldCons){ + return { + log: function(text){ + oldCons.log(text); + _loggerdata += text + "\n" + }, + info: function (text) { + oldCons.info(text); + }, + warn: function (text) { + oldCons.warn(text); + }, + error: function (text) { + oldCons.error(text); + }, + start: function() { + _loggerdata = "" + }, + end: function() { + return _loggerdata + } + }; +}(console)); + +//Then redefine the old console +console = c; \ No newline at end of file