commit cff1d9374186c212462af3497b503236917ce467
parent 18c16d82739298835dc02507b2a965e0110f8aa0
Author: Henry Unite <unitehenry@gmail.com>
Date: Thu, 26 Feb 2026 08:13:37 +0000
refactor: log level type
Diffstat:
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/app.ts b/app.ts
@@ -1,5 +1,5 @@
import express, { type Request, type Response } from "express";
-import log, { LogLevel } from "./log.ts";
+import log from "./log.ts";
import { prompt } from "./prompt.ts";
const app = express();
@@ -86,5 +86,5 @@ app.get("/health", (req, res) => res.sendStatus(200));
const port: number = parseInt(process.env.PORT || "3000", 10);
app.listen(port, (): void => {
- log(LogLevel.INFO, `Server running on port ${port}`);
+ log('INFO', `Server running on port ${port}`);
});
diff --git a/log.ts b/log.ts
@@ -1,8 +1,7 @@
-export enum LogLevel {
- "INFO",
- "WARN",
- "ERROR",
-}
+type LogLevel =
+ |'INFO'
+ |'WARN'
+ |'ERROR';
export default function log(
level: LogLevel,