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