feat: print more concise logs on Deploy (#2103)

This commit is contained in:
Marvin Hagemeister
2023-11-30 16:00:25 +01:00
committed by GitHub
parent 1501699988
commit 3b3e8fa497
2 changed files with 20 additions and 8 deletions
+18 -7
View File
@@ -1,3 +1,4 @@
import { DENO_DEPLOYMENT_ID } from "./build_id.ts";
import { colors } from "./deps.ts";
import { ServeHandler } from "./types.ts";
@@ -7,15 +8,25 @@ export async function startServer(
) {
if (!opts.onListen) {
opts.onListen = (params) => {
console.log();
console.log(
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
);
const pathname = opts.basePath + "/";
const address = colors.cyan(`http://localhost:${params.port}${pathname}`);
const address = colors.cyan(
`http://localhost:${params.port}${pathname}`,
);
const localLabel = colors.bold("Local:");
console.log(` ${localLabel} ${address}\n`);
// Print more concise output for deploy logs
if (DENO_DEPLOYMENT_ID) {
console.log(
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
);
console.log(` ${localLabel} ${address}`);
} else {
console.log();
console.log(
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
);
console.log(` ${localLabel} ${address}\n`);
}
};
}
+2 -1
View File
@@ -1,6 +1,7 @@
import { toHashString } from "./deps.ts";
const deploymentId = Deno.env.get("DENO_DEPLOYMENT_ID") ||
export const DENO_DEPLOYMENT_ID = Deno.env.get("DENO_DEPLOYMENT_ID");
const deploymentId = DENO_DEPLOYMENT_ID ||
// For CI
Deno.env.get("GITHUB_SHA") ||
crypto.randomUUID();