diff options
-rwxr-xr-x | bin/build.ts | 2 | ||||
-rw-r--r-- | src/app.ts | 10 | ||||
-rw-r--r-- | src/index.ts | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/bin/build.ts b/bin/build.ts index bd030a1..69cfd6c 100755 --- a/bin/build.ts +++ b/bin/build.ts @@ -4,7 +4,7 @@ import log from "loglevel"; import generateSite from "../src/templates"; -log.setLevel((import.meta.env.LOG_LEVEL || "info") as log.LogLevelDesc); +log.setLevel((import.meta.env["LOG_LEVEL"] || "info") as log.LogLevelDesc); fs.mkdirSync("public", { recursive: true }); log.info("Generating site..."); diff --git a/src/app.ts b/src/app.ts index a3c1c2f..6cc6520 100644 --- a/src/app.ts +++ b/src/app.ts @@ -8,10 +8,10 @@ import log from "loglevel"; import config from "./config"; -log.setLevel((import.meta.env.LOG_LEVEL || "info") as log.LogLevelDesc); +log.setLevel((import.meta.env["LOG_LEVEL"] || "info") as log.LogLevelDesc); Sentry.init({ - release: `homestead@${import.meta.env.FLY_MACHINE_VERSION}`, + release: `homestead@${import.meta.env["FLY_MACHINE_VERSION"]}`, tracesSampleRate: 1.0, }); @@ -65,7 +65,7 @@ function registerFile( pathname = "/" + (pathname === "." || pathname === "./" ? "" : pathname); if (files.get(pathname) !== undefined) { - console.warn("File already registered:", pathname); + log.warn("File already registered:", pathname); } const handle = Bun.file(filename); files.set(pathname, { @@ -280,13 +280,13 @@ export const server = { content_encoding: "identity", }); Sentry.captureException(error); - console.error("Error", error); + log.error("Error", error); return new Response("Something went wrong", { status: status }); } finally { const seconds = endTimer(); metrics.requestDuration.observe(seconds); transaction.finish(); - console.info( + log.info( request.method, status, hostname, diff --git a/src/index.ts b/src/index.ts index c12d153..0591e6d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,13 +2,13 @@ import log from "loglevel"; import { server, metricsServer } from "./app"; -log.setLevel((import.meta.env.LOG_LEVEL || "info") as log.LogLevelDesc); +log.setLevel((import.meta.env["LOG_LEVEL"] || "info") as log.LogLevelDesc); const metricsServed = Bun.serve(metricsServer); -console.info(`Metrics server started on port ${metricsServed.port}`); +log.info(`Metrics server started on port ${metricsServed.port}`); const served = Bun.serve(server); -console.info(`Serving website on ${served.url}`); +log.info(`Serving website on ${served.url}`); process.on("SIGTERM", function () { log.info("SIGTERM received, shutting down..."); |