30 lines
673 B
TypeScript
30 lines
673 B
TypeScript
let _loggerdata = ""
|
|
|
|
// define a new console
|
|
const c=(function(oldCons){
|
|
return {
|
|
log: function(text){
|
|
oldCons.log(text);
|
|
if (_loggerdata !== "") _loggerdata += "\n"
|
|
_loggerdata += text
|
|
},
|
|
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; |