From d484d8ca2a36f3a159c2348fe860ccab8182bba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=89=E4=B8=81=E5=9C=9F=E8=B1=86=E8=A1=A8?= <2507917746@qq.com> Date: Fri, 5 Apr 2024 14:51:28 +0000 Subject: [PATCH] =?UTF-8?q?Ref=20=E5=AE=8C=E5=96=84=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.d.ts | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/index.d.ts b/index.d.ts index 2770191..1564e16 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,3 +1,5 @@ +type Tostringable = string | null | boolean | undefined | number | bigint; + /** * rlog-js * @license MIT @@ -23,9 +25,9 @@ declare namespace Rlog { constructor(config: Config); config: Config; screen: Screen; - checkLogFile(path: string): Promise; + async checkLogFile(path: string): Promise; colorizeString(str: string): string; - formatTime(): string; + formatTime(): string | number; encryptPrivacyContent(str: string): string; colorizeType(variable: any): string; padLines(str: string, width: number): string; @@ -34,11 +36,11 @@ declare namespace Rlog { class Screen { constructor(toolkit: Toolkit); toolkit: Toolkit; - info(message: any, time?: string): void; - warning(message: any, time?: string): void; - error(message: any, time?: string): void; - success(message: any, time?: string): void; - exit(message: any, time?: string): void; + info(message: any, time?: Tostringable): void; + warning(message: any, time?: Tostringable): void; + error(message: any, time?: Tostringable): void; + success(message: any, time?: Tostringable): void; + exit(message: any, time?: Tostringable): void; } class File { @@ -50,25 +52,25 @@ declare namespace Rlog { init(): void; writeLogToStream(text: string): Promise; wirteLog(text: string): void; - info(message: any, time?: string): void; - warning(message: any, time?: string): void; - error(message: any, time?: string): void; - success(message: any, time?: string): void; - exit(message: any, time?: string): void; + info(message: any, time?: Tostringable): void; + warning(message: any, time?: Tostringable): void; + error(message: any, time?: Tostringable): void; + success(message: any, time?: Tostringable): void; + exit(message: any, time?: Tostringable): void; } } declare class Rlog { - constructor(config?: Rlog.Config); + constructor(config?: Partial); config: Rlog.Config; toolkit: Rlog.Toolkit; - screen: Screen; - file: File; - info(message: any): void; - warning(message: any): void; - error(message: any): void; - success(message: any): void; - exit(message: any): Promise; - log(message: any): void; + screen: Rlog.Screen; + file: Rlog.File; + info(...messages: any[]): void; + warning(...messages: any[]): void; + error(...messages: any[]): void; + success(...messages: any[]): void; + async exit(message: any): Promise; + log(...messages: any[]): void; onExit(callback: () => void): void; exitListeners: (() => void)[]; }