feat:提交

This commit is contained in:
2025-07-22 18:22:31 +08:00
parent 160bb294ca
commit 2ebb3e1abe
85 changed files with 36380 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
export class Logger
{
name: string
static interceptors: LogInterceptor[] = []
constructor(name: string)
{
this.name = name
}
static AddInterceptor(interceptor: LogInterceptor)
{
Logger.interceptors.push(interceptor)
}
error(error: Error, payload: any = null)
{
console.error(error, payload)
Logger.interceptors.forEach((i) =>
{
i.call(this, error, payload)
})
}
info(message: string, payload: any = null)
{
console.info(message, payload)
Logger.interceptors.forEach((i) =>
{
i.call(this, message, payload)
})
}
}
export type LogInterceptor = (this: Logger, info: string | Error, payload: any) => void