chore: remove debug trace logs (#2545)

This commit is contained in:
Marvin Hagemeister
2024-06-25 10:08:48 +02:00
committed by GitHub
parent 49839079a4
commit 0f6b4f624f
22 changed files with 150 additions and 8 deletions
+6
View File
@@ -216,11 +216,13 @@ export class App<State> {
} catch (err) {
if (err instanceof HttpError) {
if (err.status >= 500) {
// deno-lint-ignore no-console
console.error(err);
}
return new Response(err.message, { status: err.status });
}
// deno-lint-ignore no-console
console.error(err);
return new Response("Internal server error", { status: 500 });
}
@@ -243,16 +245,20 @@ export class App<State> {
// Don't spam logs with this on live deployments
if (!DENO_DEPLOYMENT_ID) {
// deno-lint-ignore no-console
console.log();
// deno-lint-ignore no-console
console.log(
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
);
const sep = options.remoteAddress ? "" : "\n";
const space = options.remoteAddress ? " " : "";
// deno-lint-ignore no-console
console.log(` ${localLabel} ${space}${address}${sep}`);
if (options.remoteAddress) {
const remoteLabel = colors.bold("Remote:");
const remoteAddress = colors.cyan(options.remoteAddress);
// deno-lint-ignore no-console
console.log(` ${remoteLabel} ${remoteAddress}\n`);
}
}
+1 -1
View File
@@ -199,10 +199,10 @@ export class Builder implements FreshBuilder {
buildCache.islands.set(island.name, `/${chunk}`);
}
console.trace("FLUSH");
await buildCache.flush();
if (!dev) {
// deno-lint-ignore no-console
console.log(
`Assets written to: ${colors.cyan(build.outDir)}`,
);
-3
View File
@@ -11,21 +11,18 @@ Deno.test({
builder.onTransformStaticFile(
{ pluginName: "A", filter: /\.css$/ },
() => {
console.trace();
logs.push("A");
},
);
builder.onTransformStaticFile(
{ pluginName: "B", filter: /\.css$/ },
() => {
console.trace();
logs.push("B");
},
);
builder.onTransformStaticFile(
{ pluginName: "C", filter: /\.css$/ },
() => {
console.trace();
logs.push("C");
},
);
-1
View File
@@ -143,7 +143,6 @@ export class MemoryBuildCache implements DevBuildCache {
// deno-lint-ignore require-await
async flush(): Promise<void> {
console.log("FLUSH MEMORY CACHE");
this.#ready.resolve();
}
}
@@ -22,6 +22,7 @@ export function devErrorOverlay<T>(): MiddlewareFn<T> {
}
// At this point we're pretty sure to have a server error
// deno-lint-ignore no-console
console.error(err);
return ctx.render(<FreshScripts />, init);
+4
View File
@@ -106,6 +106,7 @@ export async function updateCheck(
checkFile.last_checked = new Date().toISOString();
} catch (err) {
// Update check is optional and shouldn't abort the program.
// deno-lint-ignore no-console
console.error(
colors.red(` Update check failed: `) + err.message,
);
@@ -125,12 +126,15 @@ export async function updateCheck(
const current = colors.bold(colors.rgb8(checkFile.current_version, 208));
const latest = colors.bold(colors.rgb8(checkFile.latest_version, 121));
// deno-lint-ignore no-console
console.log(
` Fresh ${latest} is available. You're on ${current}`,
);
// deno-lint-ignore no-console
console.log(
` To upgrade, run: deno run -A -r https://fresh.deno.dev/update`,
);
// deno-lint-ignore no-console
console.log();
}
+2
View File
@@ -33,6 +33,7 @@ function reconnect() {
reconnectTimer = setTimeout(() => {
if (backoffIdx === 0) {
// deno-lint-ignore no-console
console.log(
`%c Fresh %c Connection closed. Trying to reconnect...`,
"background-color: #86efac; color: black",
@@ -84,6 +85,7 @@ function handleMessage(e: MessageEvent) {
switch (data.type) {
case "initial-state": {
if (revision === 0) {
// deno-lint-ignore no-console
console.log(
`%c Fresh %c Connected to development server.`,
"background-color: #86efac; color: black",
+1
View File
@@ -481,6 +481,7 @@ function revivePartials(
const instance = ACTIVE_PARTIALS.get(partialName);
if (instance === undefined) {
// deno-lint-ignore no-console
console.warn(`Partial "${partialName}" not found. Skipping...`);
// Partial doesn't exist on the current page
} else {
+1
View File
@@ -74,6 +74,7 @@ export function assetInternal(path: string, buildId: string): string {
url.searchParams.set(ASSET_CACHE_BUST_KEY, buildId);
return url.pathname + url.search + url.hash;
} catch (err) {
// deno-lint-ignore no-console
console.warn(
`Failed to create asset() URL, falling back to regular path ('${path}'):`,
err,