How can we disable following types of error messages displayed on the browser console under Developer Tools? Is there any flag with 4.x API?
init.js:203 Uncaught (in promise) q {name: 'identity-manager:user-aborted', details: undefined, message: 'ABORTED'}
Solved! Go to Solution.
Good Day
This is how I disable the console messages. This allows you to turn off different message types, so in production you can disable all logging, which is generally a good idea.
const disableErr: boolean = false;
const disableLog: boolean = false;
const disableTime: boolean = true;
if (window && disableLog) {
window.console.log = () => {
};
window.console.table = () => {
};
window.console.info = () => {
};
}
if (window) {
if (disableErr) {
window.console.error = () => {
};
}
if (disableTime) {
window.console.time = () => {
};
window.console.timeLog = () => {
};
window.console.timeEnd = () => {
};
}
}
Cheers
Looks like Andrew has given alternative way to achieve it. Thanks @AndrewMurdoch1 and @JoelBennett !
However, I found esri/config has log level and that can be useful.
You can use the filtering tools in your Developer Tools console to hide any unwanted messages, as described here and here. For example, I prefer not to be inundated with error messages about missing tiles, so I usually have the filter:
-blankTile=false -esri.views.2d.layers.TileLayerView2D
In your case, perhaps you could have:
-identity-manager:user-aborted
Thanks for replying @JoelBennett .
I just don't want to display these console messages coming from the API to our customers as they might be least concerned with that. I know they can be helpful for debugging. But it's better if the API has some flag value or logging level to set.
Good Day
This is how I disable the console messages. This allows you to turn off different message types, so in production you can disable all logging, which is generally a good idea.
const disableErr: boolean = false;
const disableLog: boolean = false;
const disableTime: boolean = true;
if (window && disableLog) {
window.console.log = () => {
};
window.console.table = () => {
};
window.console.info = () => {
};
}
if (window) {
if (disableErr) {
window.console.error = () => {
};
}
if (disableTime) {
window.console.time = () => {
};
window.console.timeLog = () => {
};
window.console.timeEnd = () => {
};
}
}
Cheers
Looks like Andrew has given alternative way to achieve it. Thanks @AndrewMurdoch1 and @JoelBennett !
However, I found esri/config has log level and that can be useful.