diff --git a/main.ts b/main.ts index 3566960..5332a40 100644 --- a/main.ts +++ b/main.ts @@ -2,19 +2,21 @@ import { http, log } from "./deps.ts"; import config from "./lib/config.ts"; import handler from "./lib/handler.ts"; -await log.setup({ - handlers: { - console: new log.handlers.ConsoleHandler("DEBUG", { - formatter: (rec) => `${rec.datetime.toISOString()} [${rec.levelName}] ${rec.msg}`, - }), - }, - loggers: { - default: { - level: config.debug ? "DEBUG" : "INFO", - handlers: ["console"], +async function setupLogs(): Promise { + await log.setup({ + handlers: { + console: new log.handlers.ConsoleHandler("DEBUG", { + formatter: (rec) => `${rec.datetime.toISOString()} [${rec.levelName}] ${rec.msg}`, + }), }, - }, -}); + loggers: { + default: { + level: config.debug ? "DEBUG" : "INFO", + handlers: ["console"], + }, + }, + }); +} async function handleRequest(req: Request, connInfo: http.ConnInfo): Promise { let resp: Response; @@ -39,8 +41,12 @@ async function handleRequest(req: Request, connInfo: http.ConnInfo): Promise