import { type GeneralFn } from '../../types'; /** 日志级别 */ export declare enum LogLevel { error = 0, silent = 1, warn = 2, info = 3, log = 4, debug = 5, trace = 6 } export interface LoggerOptions { /** 日志保存的目录位置。默认为空,则不保存至文件 */ logDir?: string; /** 历史日志文件有效天数。默认为 7 天。设置为 0 则不自动清理 */ validityDays?: number; /** 是否为静默模式。为 true 则不打印至控制台 */ silent?: boolean; /** 是否为调试模式。为 true 控制台打印为对象格式的日志 */ debug?: boolean; /** 日志级别 */ levelType?: LogLevelType; /** 通过外部注入 color 能力 */ color?: Record; /** 日志时间格式。默认为:yyyy-MM-dd hh:mm:ss.S */ timeFormat?: string; } export type LogLevelType = keyof typeof LogLevel; export declare class Logger { protected tag: string; protected options: LoggerOptions; static map: { [tag: string]: Logger; }; /** 日志记录级别 */ private level; get levelType(): LogLevelType; silent: GeneralFn; error: GeneralFn; warn: GeneralFn; info: GeneralFn; log: GeneralFn; debug: GeneralFn; trace: GeneralFn; /** 日志路径 */ protected logPath: string; protected logDir: string; /** 本机与服务器时间的差值 diff = Date.now() - serverTime */ private static serverTimeDiff; /** 记录日志的次数 */ private times; constructor(tag: string, options?: LoggerOptions); setLogDir(_logDir: string): void; /** * 写入到日志文件。 */ protected writeToFile(_msg: string): void; /** 更新服务器时间,计算时间差并返回 */ static setServerTime(serverTime: number): number; getSeverTime(): number; getSeverTime(toDate: true): Date; private _log; updateOptions(options: LoggerOptions): this; static getLogger(tag?: string, options?: LoggerOptions): Logger; }