mirror of
https://github.com/nestriness/nestri.git
synced 2026-08-01 17:34:15 +03:00
fix: Fix ts on logs
This commit is contained in:
@@ -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") {
|
||||||
|
|||||||
Reference in New Issue
Block a user