fix: Fix ts on logs

This commit is contained in:
Wanjohi
2025-10-26 00:06:07 +03:00
parent 815246afc0
commit f8f6aae64b

View File

@@ -4,6 +4,11 @@ import fs from "fs/promises";
import { Context } from "../context.js"; import { Context } from "../context.js";
import { Global } from "../global/index.js"; import { Global } from "../global/index.js";
type Tags = {
service: string;
[key: string]: any; // any other optional keys
};
export namespace Log { export namespace Log {
const ctx = Context.create<{ const ctx = Context.create<{
tags: Record<string, any>; tags: Record<string, any>;
@@ -102,8 +107,8 @@ export namespace Log {
} }
let last = Date.now(); let last = Date.now();
export function create(tags?: Record<string, any>) { export function create(tags: Tags) {
tags = tags || {}; tags = tags || { service: "default" };
const service = tags["service"]; const service = tags["service"];
if (service && typeof service === "string") { if (service && typeof service === "string") {