logger
commit
df6505de3c
|
@ -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;
|
Loading…
Reference in New Issue