Remove console logs, use info and error console logs

This commit is contained in:
Hans5958 2022-04-16 20:21:42 +07:00
parent 14151b639d
commit a384577050
6 changed files with 19 additions and 20 deletions

View file

@ -14,7 +14,7 @@
*/
window.addEventListener("error", function (e) {
console.log(e);
console.error(e);
let errorMessage = "<p class=\"error\">An error has occurred:</p>";
errorMessage += "<p class=\"errorBody\">" + e.message + "</p>";
errorMessage += "<p class=\"errorBody\">on line " + e.lineno + "</p>";

View file

@ -579,7 +579,7 @@ function initPeriodGroups() {
updatePeriodGroups()
} else if (event.target.textContent === "Paste") {
pathWithPeriods[index][1] = [...periodClipboard.path]
console.log(pathWithPeriods[index])
// console.log(pathWithPeriods[index])
if (pathWithPeriods.length > 2) console.log(pathWithPeriods[2])
initPeriodGroups()
}
@ -653,9 +653,9 @@ function updatePeriodGroups() {
if (periodClipboard.index !== null) {
if (index !== periodClipboard.index) {
periodCopyEl.textContent = "Paste"
console.log(JSON.stringify(pathWithPeriods[index][1]))
console.log(JSON.stringify(periodClipboard.path))
console.log(JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path))
// console.log(JSON.stringify(pathWithPeriods[index][1]))
// console.log(JSON.stringify(periodClipboard.path))
// console.log(JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path))
if (JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path)) {
periodCopyEl.disabled = true
} else {

View file

@ -74,7 +74,7 @@ function initOverlap() {
}
}
console.log(blank + " blank pixels, which are " + Math.round(blank / 100) / 100 + "% of the canvas (" + (100 - Math.round(blank / 100) / 100) + "% mapped)");
console.info(blank + " blank pixels, which are " + Math.round(blank / 100) / 100 + "% of the canvas (" + (100 - Math.round(blank / 100) / 100) + "% mapped)");
}
}

View file

@ -82,8 +82,8 @@ for (const i in areas) {
}
}
console.log("There are " + largerThanMax + " entries larger than " + max + ", accounting for " + (largerThanMax / areas.length * 100) + "% of all entries.");
console.log("The largest entry has an area of " + areas[areas.length - 1] + " pixels.");
console.info("There are " + largerThanMax + " entries larger than " + max + ", accounting for " + (largerThanMax / areas.length * 100) + "% of all entries.");
console.info("The largest entry has an area of " + areas[areas.length - 1] + " pixels.");
const counts = [0];
const brackets = [max / steps];
@ -230,12 +230,12 @@ document.getElementById("wrapper").appendChild(el);
//console.log(areas);
console.log("Median area: " + areas[~~(areas.length / 2)]);
console.info("Median area: " + areas[~~(areas.length / 2)]);
console.log("Average area: " + (areasSum / atlas.length));
console.info("Average area: " + (areasSum / atlas.length));
const topCount = 50;
console.log("The " + topCount + " largest entries:");
console.info("The " + topCount + " largest entries:");
let outstring = "";
@ -243,7 +243,7 @@ for (let i = 0; i < topCount; i++) {
outstring += ((i + 1) + "|[" + atlas[atlas.length - i - 1].name + "](http://place-atlas.stefanocoding.me/?id=" + atlas[atlas.length - i - 1].id + ")|" + ~~atlas[atlas.length - i - 1].area + "|" + Math.round(atlas[atlas.length - i - 1].area / 100) / 100 + "%\n");
}
console.log(outstring);
console.info(outstring);
atlas.sort(function (a, b) {
if (a.center[0] < b.center[0]) {
@ -256,7 +256,7 @@ atlas.sort(function (a, b) {
return 0;
});
console.log("Median x: " + atlas[~~(atlas.length / 2)].center[0]);
console.info("Median x: " + atlas[~~(atlas.length / 2)].center[0]);
atlas.sort(function (a, b) {
if (a.center[1] < b.center[1]) {
@ -269,7 +269,7 @@ atlas.sort(function (a, b) {
return 0;
});
console.log("Median y: " + atlas[~~(atlas.length / 2)].center[1]);
console.info("Median y: " + atlas[~~(atlas.length / 2)].center[1]);

View file

@ -146,7 +146,7 @@ const dispatchTimeUpdateEvent = (period = timelineSlider.value, atlas = atlas) =
}
async function updateBackground(newPeriod = currentPeriod, newVariation = currentVariation) {
console.log(newPeriod, newVariation)
// console.log(newPeriod, newVariation)
abortController.abort()
abortController = new AbortController()
currentUpdateIndex++
@ -194,11 +194,11 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren
imageCache[url] = URL.createObjectURL(imageBlob)
}
const imageLayer = new Image()
console.log(imageCache[url])
// console.log(imageCache[url])
await new Promise(resolve => {
imageLayer.onload = () => {
context.drawImage(imageLayer, 0, 0)
console.log("image done")
// console.log("image done")
resolve()
}
imageLayer.src = imageCache[url]
@ -207,7 +207,7 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren
}
if (currentUpdateIndex !== myUpdateIndex) return [configObject, newPeriod, newVariation]
const blob = await new Promise(resolve => canvas.toBlob(resolve))
console.log(URL.createObjectURL(blob))
// console.log(URL.createObjectURL(blob))
image.src = URL.createObjectURL(blob)
}

View file

@ -574,8 +574,7 @@ async function render() {
context.globalCompositeOperation = "source-over";
context.drawImage(overrideImage, startX, startY);
} catch (ex) {
console.log("Cannot override image.");
console.log(ex);
console.error("Cannot override image.", ex);
}
}
}