logger
							parent
							
								
									a5781aa7ab
								
							
						
					
					
						commit
						9a4844e34c
					
				
							
								
								
									
										19
									
								
								logger.ts
								
								
								
								
							
							
						
						
									
										19
									
								
								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; | ||||
| console = c | ||||
		Loading…
	
		Reference in New Issue