Skip to content

Instantly share code, notes, and snippets.

@cherniavskii
Last active July 19, 2018 19:53
Show Gist options
  • Save cherniavskii/a7e57a824c70da730ba636503ba4be4d to your computer and use it in GitHub Desktop.
Save cherniavskii/a7e57a824c70da730ba636503ba4be4d to your computer and use it in GitHub Desktop.
// See https://github.com/mrdoob/three.js/pull/14483
const consoleWarn = window.console.warn;
window.console.warn = function() {
const string = arguments[0];
const filterStrings = [
'is not power of two',
'image is too big',
'marked for update',
];
// filter warnings containing above strings
const shouldBeFiltered = filterStrings.some(string => (
arguments[0].includes('THREE') && arguments[0].includes(string)
);
if (shouldBeFiltered) {
// log it to console without second argument, which contains reference to `image`
consoleWarn.call(null, arguments[0]);
} else {
// pass other warnings without changes
consoleWarn.apply(null, arguments);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment