|
@@ -3,22 +3,22 @@
|
|
|
*/
|
|
|
export function ConsoleOutputDisableExpressionTemplate (): string {
|
|
|
return `
|
|
|
- const {consoleLogDisableFunctionName} = {callControllerFunctionName}(this, function () {
|
|
|
+ const {consoleLogDisableFunctionName} = {callControllerFunctionName}(this, function () {
|
|
|
{globalVariableTemplate}
|
|
|
-
|
|
|
- const _console = (that.console = that.console || {});
|
|
|
+
|
|
|
+ const consoleObject = (that.console = that.console || {});
|
|
|
const methods = ['log', 'warn', 'info', 'error', 'exception', 'table', 'trace'];
|
|
|
-
|
|
|
+
|
|
|
for (let index = 0; index < methods.length; index++){
|
|
|
- const func = {callControllerFunctionName}.constructor();
|
|
|
+ const func = {callControllerFunctionName}.constructor.prototype.bind({callControllerFunctionName});
|
|
|
const methodName = methods[index];
|
|
|
- const originalFunction = _console[methodName] || func;
|
|
|
+ const originalFunction = consoleObject[methodName] || func;
|
|
|
|
|
|
func.toString = originalFunction.toString.bind(originalFunction);
|
|
|
- _console[methodName] = func;
|
|
|
- };
|
|
|
+ consoleObject[methodName] = func;
|
|
|
+ }
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
{consoleLogDisableFunctionName}();
|
|
|
`;
|
|
|
}
|