import { EasyMap } from "../extends-map/index.js"; import type { $NamespaceFilter, $LogArgs, $Scope, $LevelFilter, $DebugLevel, $DebuggerOptions, $Pinter } from "./$types.js"; /** * Convert regexp to namespace * * @param {RegExp} regxep * @return {String} namespace * @api private */ export declare function regexpToNamespace(regexp: RegExp): string; export declare function transformNamespaceToFilter(namespace: string): $NamespaceFilter; export declare function transformFilterToNamespace(filter: $NamespaceFilter): string; /** * 这个类只会执行一次 * 只是因为涉及到多个平台的不同实现,所以这里使用非即时执行的方式,用Class进行包裹实现 */ export declare abstract class DebugCreater { constructor(); abstract colors: ColorType[]; abstract get colorTypeName(): string; protected abstract load(): string; protected abstract save(namespace: string): void; abstract canUseColors(): boolean; abstract formatArgs(debug: Debug, args: $LogArgs, scope: $Scope): void; abstract init?(debug: Debug): void; abstract printArgs(debug: Debug, args: $LogArgs, scope: $Scope): void; /** * Map of special "%n" handling functions, for the debug "format" argument. * * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". */ abstract formatters: { [key: string]: (debug: Debug, val: unknown) => string; }; /** * The currently active debug mode names, and names to skip. */ readonly namespaceFilters: $NamespaceFilter[]; /** * Disable debug output. * * @return {String} namespaces * @api public */ getNamespaceFilter(): string[]; /** * 重置所有日志实例是否可用 */ private _resetInstancesEnabled; /** * Enables a debug mode by namespaces. This can include modes * separated by a colon and wildcards. * * @param {String} namespaces * @api public */ setNamespaceFilter(namespaces: string | string[]): void; addNamespaceFilter(filter: string | $NamespaceFilter, pos?: number): void; removeNamespaceFilter(filter: number | string | $NamespaceFilter): boolean; private _levelFilter; get levelFilter(): $LevelFilter; set levelFilter(value: $LevelFilter); /** * Returns true if the given mode name is enabled, false otherwise. * * @param {String} name * @return {Boolean} * @api public */ isEnabled(name: string, level: $DebugLevel): boolean; /** * Selects a color for a debug namespace * @param {String} namespace The namespace string for the for the debug instance to be colored * @return {Number|String} An ANSI color code for the given namespace * @api private */ selectColor(namespace: string): ColorType; private _createdDebugCache; /** * 获取创建过的命名空间 */ getCreatedDebugs(): IterableIterator>; /**生成一个命名空间创建一个日志打印器 */ create(namespace: string): Debug; destroy(namespace: string): boolean; } export declare class Debug { readonly namespace: string; private _creater; private _config; get useColors(): boolean; forceSetUseColors(useColors: boolean): void; get enabled(): boolean; forceSetEnabled(v: boolean): void; get color(): ColorType; get level(): number; get enableTime(): boolean; get enableDuration(): boolean; getDiff(): number; private __prev; private __curr; protected get _prev(): number; protected get _curr(): number; protected _resetDiff(): void; constructor(namespace: string, _creater: DebugCreater, opts?: $DebuggerOptions); getDuration(): string; private get _dater(); getTime(): string; destroy(): void; get print(): $Pinter; createPrinter(color: ColorType, level: $DebugLevel): $Pinter; deletePrinter(color: ColorType, level: $DebugLevel): boolean; private _scope; private _scopeIdAcc; readonly scopePrinterMap: EasyMap<$Scope, $Pinter, $Scope>; /**禁用默认的格式化输出,因系统console.log中有自带 */ protected $enableDefaultFormatter: boolean; private _printerBuilder; } export declare enum LOGGER_LEVEL { log = 0, info = 1, warn = 2, trace = 3, success = 4, error = 5 }