UNPKG

@hyext/utils

Version:

A tools lib for huya miniapp business development

31 lines (30 loc) 932 B
declare type LogInfo = { prefix: string; msg: string; data: any; desc: string; }; declare type CreateLoggerOptions = { onBefore?: (logInfo: LogInfo) => void; onAfter?: (logInfo: LogInfo) => void; prefix?: (() => string) | string; logColor?: LogColor; enableLog?: boolean | ((logInfo: LogInfo) => boolean); remoteLoggerUrl?: string | ((defaultPath: string) => string); }; declare type LogColor = { info?: string; warn?: string; error?: string; log?: string; }; declare type logFn = (msg: string, data?: any) => {}; export interface HyextLogger { info: logFn; warn: logFn; error: logFn; log: logFn; } export declare const sendDevLog: (message: string, level: 'info' | 'warn' | 'error' | 'success', loggerUrl?: string | undefined) => void; export declare const createLogger: (options: CreateLoggerOptions) => HyextLogger; export {};