Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: URL parameter to disable console logging #1420

Open
ajmeese7 opened this issue Sep 18, 2022 · 0 comments · May be fixed by #1619
Open

Feature request: URL parameter to disable console logging #1420

ajmeese7 opened this issue Sep 18, 2022 · 0 comments · May be fixed by #1619
Labels

Comments

@ajmeese7
Copy link

Is your feature request related to a problem? Please describe.
My use case is implementing this application in an iFrame, where ideally I would like to avoid logging to the console if possible. Some of the output I would like to avoid being displayed is the following:

unwanted console output

Describe the solution you'd like
A URL parameter specifying that nothing should be output to the console, something like ?logging=false.

Describe alternatives you've considered
I have tried to intercept calls to console.* on my end, but since it is a cross-origin iframe, the following code just results in a DOMException:

iframe.onload = () => {
	iframe.contentWindow.console.log = () => {};
	iframe.contentWindow.console.error = () => {};
	iframe.contentWindow.console.warn = () => {};
	iframe.contentWindow.console.info = () => {};
	iframe.contentWindow.console.debug = () => {};
}

Additional context
The implementation would simply need to be something along the lines of the following when the URL parameter is present:

window.console.log = () => {};
window.console.error = () => {};
window.console.warn = () => {};
window.console.info = () => {};
window.console.debug = () => {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant