import CacheInt from '@blued-core/cache-intl'; import { RecordLogType, KafkaConf } from './config'; import 'winston-daily-rotate-file'; import { Loggers, LoggerClient, KafkaLogDefaultMeta, LogLevel } from './config/type'; export * from './config/type'; interface LoggerIntl { logType: string; logPath: string; cache?: CacheInt; getLogger: (logType: string) => LoggerClient; buildLogger: (logType: string) => Loggers; } export default class WinstonLogger implements LoggerIntl { logType: string; appName: string; logPath: string; cache: CacheInt; recordType: RecordLogType; kafkaConf: KafkaConf; maxMsgCount: number; maxBulkSize: number; private clusterClient; private msgQueue; private callbackFn; constructor({ appName, logPath, cache, recordType, kafkaConf, maxBulkSize, maxMsgCount, callbackFn, }: { appName: string; logPath: string; cache: CacheInt; recordType: RecordLogType; kafkaConf: KafkaConf; maxMsgCount: number; maxBulkSize: number; callbackFn?: (logName: string, level: LogLevel) => any; }); kafkaLogReport(message: any, meta: KafkaLogDefaultMeta): void; buildLogger(logType: string): Loggers; getLogger(logType: string): { access(data?: Record): void; error(error: Error, data?: Record): void; }; private initKafka; private kafkaReport; private createCluster; private heartBeatCheck; }