tslib/logger.ts

29 lines
624 B
TypeScript

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;